Hi everyone.
I am using Xray on a an instance of JIRA server. I would like to use the REST API to add an attachment to an XRAY Test step.
Piecing together information from different sources (source1 , source2 , source3 ) , I have settled on the following request:
URL = https://{jira server}/rest/raven/2.0/api/test/{testKey}/steps/{testId}
HTTPRequest = PUT
Body = {
"attachments": {
"add":[
{
"data":"MTAwIHJwbQ0KMjAwIHJwbQ0KMzAwIHJwbQ==",
"filename":"speed points.txt",
"contentType": "text/plain",
}
]
}
}
But that gives the following response
400
{'error': 'Step fields must be provided to create a new test step'}
So then I tried the following request:
URL = https://{jira server}/rest/raven/2.0/api/test/{testKey}/steps/{testId}
HTTPRequest = PUT
Body = {
"fields":{
"Action":"Testing"
},
"attachments": {
"add":[
{
"data":"MTAwIHJwbQ0KMjAwIHJwbQ0KMzAwIHJwbQ==",
"filename":"speed points.txt",
"contentType": "text/plain"
}
]
}
}which gives the following response:
200
{'step': {'id': 270216, 'attachmentIds': []}, 'warnings': ['Error creating attachment.']}
And just as the response describes, the action field is updated, but no attachment was created!
Can someone help me with creating an attachment through scripts in XRAY Server?
Right now I am trying to maybe see if it is possible to make the same requests in a script the web page makes when creating an attachment. I haven't yet fully explored this option!