How can I create a Jira Issue through POST API?

Gomez de la Vega, Hernando July 23, 2024

Hello! I am using this URL: 'https://honeywell.atlassian.net/rest/api/2/issue/' to create issues by passing data in JSON format.

The method used to work before we migrated from on-prem to cloud. However when I try to do the same in the cloud instance I am getting the following error:

Using Basic authorization

Error.png

Alternatively, I tried the API Token using Bearer authorization but I'm getting this error:

Screenshot 2024-07-23 172051_JIRA_BEARER_403.png

Any help much appreciated!

2 answers

1 accepted

0 votes
Answer accepted
Gomez de la Vega, Hernando July 31, 2024

For solution, please refer to this post:

Solved: Issue with API for creating issues (atlassian.com)

0 votes
Caio Covos
Contributor
July 23, 2024

Hi @Gomez de la Vega, Hernando

For Jira Cloud, you typically use API tokens instead of passwords for Basic authentication. Here’s how to set it up and make a successful POST request:

Step-by-Step Guide

1. Generate an API Token

1. Go to Atlassian API tokens.

2. Click Create API token.

3. Name your token and click Create.

4. Copy the token to use it in your requests.

 

2. Base64 Encode the Email and API Token

Combine your Atlassian account email and the API token in the format email:api_token and then Base64 encode this string.

You can use this site to encode: https://www.base64encode.org/

Checklist

•Ensure the API token is correct and active.

•Verify that the user has the necessary permissions in the Jira Cloud project.

• Use the correct endpoint URL: https://your-domain.atlassian.net/rest/api/2/issue/.

•Use Basic authentication with the encoded email:api_token string.

•Make sure your request headers include Content-Type: application/json.

 

By following these steps, you should be able to successfully create issues in Jira Cloud using the REST API. If you still encounter issues, please provide the exact error messages for further assistance.

Gomez de la Vega, Hernando July 23, 2024

Thanks Caio!

On step 2, I am using Content-Type:application/json as you mentioned and email:password Authorization base64 encoded. The reply is HTTP 405 Method not allowed.

Since that didn't work, I tried the API Token via Bearer Authorization but it gives 

"Failed to parse Connect Session Auth Token"

So both steps have been tried without success. Not sure if this might be because it's a new Jira Cloud instance...


Suggest an answer

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

Atlassian Community Events