Reputation: 135
I am trying to create a test using Xray REST API. At the time of creation, I am also trying to add the test case to a test set which already exists.
This is my input json for the POST.
{
"fields":
{
"project": {"key": "TEAM"}
,"summary": "Sum of two numbers-1"
,"description": "example of manual test-1"
,"issuetype": { "name": "Test" }
,"customfield_23240": { "value": "Manual" }
,"customfield_23244": {
"steps":[
{ "index": 0, "step": "Step 1",
"data": "input Data 1",
"result": "Excepted result 1"
},
{ "index": 1, "step": "Step 2",
"data": "input Data 2",
"result": "Excepted result 2"
},
{ "index": 2, "step": "Step 3",
"data": "input Data 3",
"result": "Excepted result 3"
},
{
"index": 3, "step": "Step 4",
"data": "input Data 4",
"result": "Excepted result 4"
}
]}
, "customfield_23246": { "set": [ "TEAM-12" ] }
}
}
I have double-checked the customfield ids and they are correct.
This is the command I am running
curl -H "Content-Type: application/json"
-X POST --data @test-1.json
-u user:pwd https://myserver/rest/api/2/issue
But I am getting http 500 error.
{"errorMessages":["Internal server error"],"errors":{}}
Am I doing something wrong or am I doing something which is not supported by API. It is not clear to me from Xray documentation.
Upvotes: 1
Views: 2745
Reputation: 135
After a long trial and error exercise, finally found the correct json to be posted.
This "customfield_23246":{"set":["TEAM-12"]}
was changed to "customfield_23246":["TEAM-12"]
This is the correct input json.
{
"fields": {
"project": { "key": "TEAM" }
,"summary": "Sum of two numbers-1"
,"description": "example of manual test-1"
,"issuetype": { "name": "Test" }
,"customfield_23240": { "value": "Manual" }
,"customfield_23244": {
"steps":[
{
"index": 0,"step": "Step 1",
"data": "input Data 1",
"result": "Excepted result 1"}
,{
"index": 1, "step": "Step 2",
"data": "input Data 2",
"result": "Excepted result 2"}
,{
"index": 2,"step": "Step 3",
"data": "input Data 3",
"result": "Excepted result 3"}
,{
"index": 3, "step": "Step 4",
"data": "input Data 4",
"result": "Excepted result 4"
}
]
}
,"customfield_23246" : ["TEAM-12"]
}
}
Upvotes: 1