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
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events