Forums

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

JIRA REST API query string issue

Nidhin Kuttikkattu Rajeevan September 18, 2023

Hi All,

I have a couple of test JIRA tickets. 

names are TEST1, TEST2,TEST3

I created a test execution ticket via REST API say MYTESTEXECUTION

I am trying to attach TEST1,TEST2,TEST3 to MYTESTEXECUTION

Actually this TEST1,.....TEST100 are in a csv. So I read them to a python array. 

When I feed this in my REST API, like TEST1,TEST2,TEST3 it is working.

But, if I pass the array as argument, it is not attaching the tests to the test execution ticket. 

 

 response = requests.post(
        'myJIRAServer/rest/raven/1.0/api/testexec/'+str(issue_key)+'/test',
        headers=headers,
        json=json_data,
        )
if(response.status_code == 200):
   print "success"
myTestArray = ["TEST1","TEST1","TEST1"]
where jason_data is
  json_data = {
        'add': [      
        "TEST1","TEST2","TEST3" # Working 
        #myTestAarray --->this is commented now. If I comment above line and use 
        #myTestArray, it is not woking
        ],
        }

1 answer

1 vote
Felix Linh
Contributor
September 18, 2023

Hi @Nidhin Kuttikkattu Rajeevan nice to meet you and I would like to express my interesting in this issue.

Modify the "jsondata" object to assign the value of "myTestArray" to the 'add' field:

```python
json_data = {
     'add': myTestArray
}
```

 

Update the POST request to include the modified "jsondata":

```python
response = requests.post(
     'myJIRAServer/rest/raven/1.0/api/testexec/' + str(issue_key) + '/test',
     headers=headers,
     json=json_data
)
```

 

Thank you,

Felix M.

Nidhin Kuttikkattu Rajeevan September 18, 2023

Thank you Felix. It works. cheers..

Nidhin Kuttikkattu Rajeevan September 22, 2023

Hello Felix.. Apologies, last time, I was checking the response only. The response is 200 now. But I can see that it is a success response. But the tests I passed are still not attached to the test execution. Also, I would expect 201 as response I think :-( 

Suggest an answer

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

Atlassian Community Events