How to add an attachment to each Test Step in XRAY REST API

Hoi Tran July 11, 2021

Hi team,

https://docs.getxray.app/display/XRAYCLOUD/Importing+Tests+-+REST+v2

Document just mentions to how to upload fields action, data, result to each test step in Test. How about with field "attachment" in each test step, Do you support this?Screen Shot 2021-07-12 at 10.14.23.pngScreen Shot 2021-07-12 at 10.15.54.png How to add an attachment/picture to each Test Step with XRAY REST API (XRAY CLOUD)?

Thanks,

Hoi

 

2 answers

1 accepted

1 vote
Answer accepted
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2021

Hi @Hoi Tran 

You need to use GraphQL (https://docs.getxray.app/display/XRAYCLOUD/GraphQL+API) and the mutation  updateTestStep (https://xray.cloud.xpand-it.com/doc/graphql/updateteststep.doc.html).

As an input, you have the object UpdateStepInput where you can set the Attachment.

Any additional questions, please get in touch with Xray Support (http://xraysupport.xpand-it.com); we would gladly assist you.

Thank you.

Kind regards,
Rogério Paiva [Xray Support Team]

Hoi Tran July 27, 2021

Hi @Rogério Paiva - Xray Xporter ,

Thanks for your response. However, I don't think that answers my question.

As your guideline, to use GraphQL, we need to use Insomnia with GUI.

In this case, I need some APIs (script) to automatically upload test steps (include data, image, attachment) to Xray TEST type. Does XRAY support this?

Thanks,

Hoi

Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2021

Hi @Hoi Tran 

No, the GraphQL does not require Insomnia, we suggest this tool to test the API, but it is not mandatory. You can make GraphQL requests similar to REST API requests inside code/scripting; it is only necessary to respect the GraphQL request format.

GraphQL still executes over an HTTP protocol, just like other API requests.

Thank you.

Kind regards,
Rogério Paiva [Xray Support Team]

Like Hoi Tran likes this
Hoi Tran July 30, 2021

@Rogério Paiva - Xray Xporter Great! That what I am looking for. Thanks so much.

Do you have any examples for that, eg. for authentication like REST API?

I referred your link: http://xraysupport.xpand-it.com

but just see:

Screen Shot 2021-07-30 at 16.19.52.png

Do I need to raise a question to that page?

Thanks,

Hoi

Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2021

Hi @Hoi Tran 

That link is for the support service desk, and yes you may raise a question there.

Nevertheless, here are the documentation links to the authentication:

https://docs.getxray.app/display/XRAYCLOUD/GraphQL+API

Requests made to Xray's GraphQL API must also be authenticated using the same endpoint for REST API authentication.

Thank you.

Kind regards,
Rogério Paiva [Xray Support Team]

Like Hoi Tran likes this
Hoi Tran July 30, 2021

@Rogério Paiva - Xray Xporter Thanks so much for your support.

I found the HTTP request form what you mentioned to:

https://graphql.org/learn/serving-over-http/ 

GET:

http://myapi/graphql?query={me{name}}

POST:

{
"query": "...",
"operationName": "...",
"variables": { "myVariable": "someValue", ... }
}

Thanks,

Hoi

0 votes
Radhika Singiri November 12, 2021

I accept

Suggest an answer

Log in or Sign up to answer