我正在尝试打电话给get call。这些呼叫未始终通过。我在哪里获得适当的CXRF令牌。
获取URL呼叫:
Given url appServer +'/integration/live/rest/accessProfile'+'?page=0'+'&pageSize=10'+'&sortBy=name'+'&fieldList=name,id,date_created,date_modified,created_id,modified_id'+'&filter=id%20not%20equal%20to%20%27200%27%20AND%20id%20not%20equal%20to%20%27100%27%20AND%20id%20not%20equal%20to%20%27101%27%20AND%20id%20not%20equal%20to%20%27102%27%20AND%20id%20not%20equal%20to%20%27103%27%20'+'&getTotalRecordCount=true
完整代码:
Scenario: create Access Profile
Given url appServer +'/integration/live/rest/accessProfile'+'?page=0'+'&pageSize=10'+'&sortBy=name'+'&fieldList=name,id,date_created,date_modified,created_id,modified_id'+'&filter=id%20not%20equal%20to%20%27200%27%20AND%20id%20not%20equal%20to%20%27100%27%20AND%20id%20not%20equal%20to%20%27101%27%20AND%20id%20not%20equal%20to%20%27102%27%20AND%20id%20not%20equal%20to%20%27103%27%20'+'&getTotalRecordCount=true'
And header X-CSRF-TOKEN = csrfToken
* cookie JSESSIONID = jsessionid
Given request ' '
When method get
Then status 200
And print response
Then match response.platform.message.code contains '0'
Then match response.platform.message.description contains 'Success'
* def accessProfileNames = get response.platform.record[*].name
* print accessProfileNames
Then match accessProfileNames contains 'TestAccessProfile'
#fetch the access profile id
* def AccessProfileNode = get[0] response.platform.record[?(@.name=='TestAccessProfile')]
* def accessProfileId = AccessProfileNode.id
* print accessProfileId
答案 0 :(得分:0)
请检查您是否已传递所有必需的标头。
您很可能错过了一个-例如需要一个cookie。