Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

curl POST cmd works to post to execution evidence in xray but doesn't work with python requests.post Edited

Below curl command works if post to execution evidence in Xray and attaching test.log file to evidence field:

curl -H "Content-Type: application/json" -X POST -u user:pwd --data @test.json https://jira.opentv.com/rest/raven/1.0/api/testrun/{id}/attachment

where test.json has this,

{
"data":"VGhpcyBmaWxlIGlzIHRlc3RpbmcgZm9yIHVwbG9hZCB0byBleGVjdXRpb24gZGV0YWlscy4=",
"filename":"test.log",
"contentType":"application/json"
}   (in json 'data' is base64 encoded which is only supported in xray)

but when i try the same with below requests.post it fails. 

requests.post('https://jira.opentv.com/rest/raven/1.0/api/testrun/{id}/attachment',headers = {'Content-Type':'application/json'},data={"data":"VGhpcyBmaWxlIGlzIHRlc3RpbmcgZm9yIHVwbG9hZCB0byBleGVjdXRpb24gZGV0YWlscy4=","fileName":"test.log","Content-Type":"application/json"},auth=('user', 'pwd'))

Thanks in Advance..

the curl cmd is executed from linux machine and python requests.post from windows. Both are reachable to Xray.

1 answer

Hi @Suryakant

Curl command works manually. The request works but will fail when using it inside your custom application. 
Since the Xray itself is working, there is not much else we can help as we don't provide support to custom applications.

We do have several code samples (some using Python) which you could use as a reference to build your own application.

Please check the link Tutorials, Tips and Tricks - Automation to get those samples; remember that those samples are provided "as is" and they are not supposed to be used on production and may need adjustments to work on your environment.

Please let us know if you have any questions or issues with Xray through our Service Desk

Best Regards,

Team Xray

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

260 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you