HI Team,
I am trying to create a Jira issue using Rest API and need to specify which sprint this issue needs to be created.
I have used below schema, however, the "bad request " error is thrown.
1.
"fields": {
"project": {
"id": "10000"
},
"summary": "something'\''s wrong",
"issuetype": {
"id": "10000"
},
"assignee": {
"name": "homer"
},
"reporter": {
"name": "smithers"
},
"priority": {
"id": "20000"
},
“Sprint: : {
“name”: “Sprint1:
},
"labels": [
"bugfix",
"blitz_test"
]
Throws bad request error
"fields": {
"project": {
"id": "10000"
},
"summary": "something'\''s wrong",
"issuetype": {
"id": "10000"
},
"assignee": {
"name": "homer"
},
"reporter": {
"name": "smithers"
},
"priority": {
"id": "20000"
},
“Sprint: : “Sprint1",
"labels": [
"bugfix",
"blitz_test"
this as well throws "bad request" error.
],
There must be a error message together with the bad request error. What is the error?
Nothing, It just states Reason Phase as blank and status as "bad request"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should use Jira Software Rest Api
https://developer.atlassian.com/cloud/jira/software/rest/#api-sprint-sprintId-issue-post
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was trying to use this example
However i am creating a class to send the data
public class Fields
{
public Project project { get; set; }
public string summary { get; set; }
public string description { get; set; }
public int customfield_XXXXX { get; set; }
}
this is giving bad request as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is right because if you generate a json from the class it will not be the json you need. Jira accepts only certaion jsons. In your case it must be like this
{
"fields": {
"project":
{
"key": "SP"
},
"summary": "Sprint issue test",
"description": "REST APIs are great.",
"issuetype": {
"name": "Bug"
},
"customfield_10001": 1
}
}Your Json will be like this
{"project":"SP", "summary": "Sprint issue test", "description": "REST APIs are great."," customfield_XXXXX": "Sprint 1"}
It is a bad request. You need to create a class with the fields variable which is of the Fields class. Also you need to create a project class with the key variable and the project variable in Fields class must be of this class. And you also need an issue type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.