I am trying to create an issue using Jira REST API on Postman, Getting status 415 Unsupported media

AI March 27, 2024

Solution :  Changed the Content-type in headers text/html to application/Json for this error code 415, Issue has been fixed.

Details : I am using limited fields which are there in Create screen,

Requirement : Create issue in Jira and Create Link for another issue type

Here is my Payload :

{
"fields":{
"project":{
"key":"APPI"
},
"summary":"Test_Postman1",
"description":"Test description",
"Priority":"High",
"issuetype":{
"name":"Task"
},
"assignee":{
"name":"XYZ"
},
"reporter":{
"name":"Anna",
"customfield_10010":"Start a New Portal Issue Ticket"
}

}
}

1 answer

1 accepted

1 vote
Answer accepted
Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2024

I was able to post and create using below request.

Maybe try small first and add elements slowly.

In browser, Open Jira, take a sample issue key, go to new browser tab, replace bolded below / paste / hit enter / review response on how object is structured and add items slowly to make sure they are working as you go along:

https://yourdomain.net/rest/api/2/issue/ABCD-1234?expand=names

 

{
"fields":{
"project":{
"key":"APPI"
},
"priority": {
"name": "High"

},
"summary":"Test_Postman1",
"description":"Test description",
"issuetype":{
"name":"Task"
}

}
}

AI March 27, 2024

I am getting the response and added items as per the structure, still getting the same.

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2024

Are you sure what ever you are passing as assignee name is what Jira is expecting?

Because every Jira set up is different, we cannot tell you correct JSON.

When creating a task in UI, see whats the bare minimum fields it needs, simply put that to begin with and confirm if that works.

I would especially remove the assignee part for now as system defaults to Project Lead's name anyways. 

AI March 27, 2024

I have removed the assignee and Custom field too, the Custom field : Request type in JSM and Required, I have removed that too however getting same.

 

{
"fields":{
"project":{
"key":"NP"
},
"summary":"Test_Postman1",
"issuetype":{
"name":"PR"
},
}
}

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2024

I just tested below JSON and it worked..

Also share what response you are getting trying below version.

 

{
"fields":{
"project":{
"key":"SUP"
},
"priority": {
"name": "High"

},
"summary":"Test_Postman1",
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "description"
}
]
}
]
},
"issuetype":{
"name":"Task"
}

}
}

 

Also, Please review sample structure in below link:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post

AI March 27, 2024

Screenshot 2024-03-27 201419.pngI have tried with Request type and without request type which is mandatory field but still it's same

AI March 27, 2024

Screenshot 2024-03-27 202045.jpg

Here is my Issue create page. Does it required any Api permission to get into Jira JSM, I have a Administrator role.

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2024

Please cross check what you have for content-type in your header, should be application/json

 

See below:

https://community.developer.atlassian.com/t/post-api-call-return-error-415/62992

AI March 28, 2024

Grate! its worked, Content type was text/html changed to application/Json.

I am trying to add all fields.

Thanks again!

Kalyan Sattaluri
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2024

Uff. We shoudl have checked that first. But glad we have a beginning.

Can you please update your first post that the solution was to change content-type for this error code and mark this answer accepted so that folks in the future can quickly get to the answer so they dont waste time like we did.. lol.. Thanks!

AI March 28, 2024

I should have been check that, Updated Thanks!

Like Kalyan Sattaluri likes this

Suggest an answer

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

Atlassian Community Events