Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Xray cloud graphql - curl format error

Asitha March 25, 2024

I have been trying to utilise this grapqhl mutation to update a test plan with test executions.
https://xray.cloud.getxray.app/doc/graphql/addtestexecutionstotestplan.doc.html 

While trying to do this via github actions I face an error with the json format.

Here ${{ needs.testex.outputs.executions }} returns an json array ["123","234"] etc..

curl -X POST -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d '{"query":"mutation {addTestsToTestPlan(issueId: \"119\",testIssueIds: ${{ needs.testex.outputs.executions }}) {addedTests warning}}","variables":{}}' https://xray.cloud.getxray.app/api/v2/graphql

 But every attempt has met with either something like
{"errors":[{"message":"Expected type String, found 121335.","locations":[{"line":1,"column":78}]}...
or

{"error":"Server Error - Unexpected token \\ in JSON at position 75"}

Note :
It works if I hardcode like this.


curl -X POST -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d '{"query":"mutation {addTestsToTestPlan(issueId: \"119\",testIssueIds: [\"123\",\"234\"]) {addedTests warning}}","variables":{}}' https://xray.cloud.getxray.app/api/v2/graphql

 Any help is greatly appreciated on this matter.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events