Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

400 error when creating issue via REST API

Dane.Foster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 2, 2020

I setup a free cloud account that I'm trying to use to learn Jira's REST API. I have not modified any of the Jira settings and I'm trying to create my first test issue by POST'ing the following to https://valhala.atlassian.net/rest/api/2/issue:

{
"fields":{
"project":{"id":"10000"},
"summary":"Bot bug report on behalf of some name: some email",
"issuetype":{"id":"10001"}
}
}

 I keep getting 400 error and no response text explaining why. My headers are:

Accept: application/json
Content-Type: application/json
Authorization: Basic base64encoded_email:token

I'm at my wits end. Please help. Thank you.

3 answers

1 accepted

0 votes
Answer accepted
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2020

Hi @Dane.Foster ,

welcome to the Atlassian community!

Please look at the documentation for Jira cloud - create issue section.

The correct url is: https://valhala.atlassian.net/rest/api/3/issue

Provided payload seems correct to me, but please check all the ids, if they are valid for your projects and issue types.

I would recommend you to use Postman application - it enables you to debug the requests and you should be able to get the error message to find out, where the problem is.

Dane.Foster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 2, 2020

That did the trick. Thank you sooooo MUCH! I REALLY appreciate it! You da bomb!

Apeksha July 31, 2023

@Dane.Foster  Hi would you like to share your trick because I am also facing same issue 

0 votes
Apeksha July 31, 2023

Hi,

XRAY_DOMAIN + '/rest/api/3/issue'
postdata= 
 {
            "fields": {
              "description": {
                "content": [
                  {
                    "content": [
                      {
                        "text": "Order entry fails when selecting supplier.",
                        "type": "text"
                      }
                    ],
                    "type": "paragraph"
                  }
                ],
                "type": "doc",
                "version": 1
              },
              "issuetype": {
                "id": "10009"
              },
              "labels": [
                "bugfix",
                "blitz_test"
              ],
              "project": {
                "id": "PROJECT CODE"
              },
              "summary": "Main order flow broken",
              "timetracking": {
                "originalEstimate": "10",
                "remainingEstimate": "5"
              }
            },
            "update": {}
          }
0 votes
Apeksha July 31, 2023

@Dane.Foster @Hana Kučerová  currently i am trying to use https://inhomeengineering.atlassian.net/rest/api/3/issue with payload  

postBody2 => {
fields: {
project: { id: 10004 },
summary: 'ARRIS_MV1_TEST_SET_partial_apeksha_SN_2023-07-31_084605615',
description: 'ARRIS_MV1_TEST_SET_partial_apeksha_SN_2023-07-31_084605615',
issuetype: { id: '10009' }
}

but getting error as 400  what is in solution you are providing on https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post this link its asking to much information I am not able to understand what are the required things for this please suggest something   

Apeksha July 31, 2023

hi I got solution Thanks 

Khushboo kabra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 31, 2023

Hello @Apeksha

I am facing the same issue, How you resolved this please tell me, if possible.

Thanks!

Apeksha November 16, 2023 edited

@Khushboo kabra  in node js code after creating postdata  as mention above you have to call the 

var resultStep3 = await urllib.request(YOUR_ATLASSIAN_JIRA_DOMAIN + '/rest/api/3/issue',
            {
                enableProxy: config.PROXY_STATUS,
                proxy: config.PROXY_URL,
                timeout: [1000000, 1800000],
                method: "POST",
                headers:
                    'Accept': 'application/json',
                    'Content-Type': 'application/json',
                    "Authorization" : auth  /* set token */
                },
                data: postdata,
                contentType: "application/x-www-form-urlencoded",
            }
        );
        var issueKey = JSON.parse(resultStep3.data.toString()).key;
        var issueId = JSON.parse(resultStep3.data.toString()).id
        console.log('issueId  === >>>> ', issueId, 'issueKey ====>>> ', issueKey);

Suggest an answer

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

Upcoming Jira Events