How to Access JIRA cloud Rest API

 I have been attempting to access various JIRA Cloud APIs, but unfortunately, I have been facing difficulties in connecting to JIRA Cloud and have not been able to successfully hit any of the APIs. Despite researching the errors I've encountered, I have been unable to find a solution that will allow me to access the API.

I am pretty sure before coming here, you would have searched for a solution (like crazy) but ended up with either one of the below-mentioned error messages.

{
“error”: “Failed to parse Connect Session Auth Token”
}

Or

{
“errorMessages”:
[“Issue does not exist or you do not have permission to see it.”], “errors”: {}
}

This page will give you complete step by step procedure to access the API.

Now let us fix this issue step by step



Step 1: Generating the API Token

Log in to your Jira cloud account and then click on the below link
https://id.atlassian.com/manage-profile/security/api-tokens
or
1. Hover over on “Your profile and settings” and click on “Account settings”
2. Select the “Security” option and click on
Create and Manage API tokens” under API token section.
The information below will be displayed on your screen:


3. Click on “Create API token” and generate and save it on your note pad for future use.

Step 2: Generating the Authorization Token to access the API

We cannot access the API using the token generated in Step 1.
Authorization token should always be in Base64 format so now we need to convert our API token into Base64 format.

How do we convert that?
You can use any online converts but I have used the below-mentioned link to convert it.
https://www.base64encode.org/
Enter your Email ID and Password in below format :
JIRA Cloud account Email ID: API token [Generated in Step 1]
Example :
ranjeet@gmail.com:PkZCF07tUydsvds44r3r4r2ccr
and click on the “Encode” button and you will be ready with the Authorization token. And it looks something like this [c7ZjLmW1dG9tYXRpb251c2QyQGVnLmNvpFoQa0pDRjA1dFV5ck1heDFkU1NqUzUzQzU=]

So here we generated the authorization token using the email ID and the API token.

Step 3: Accessing JIRA API

In the above steps, we have seen how we can generate the API token and authorization token so let us try to hit the API.
Talend API Tester is a plugin that can be used with the Google Chrome browser.
You can configure Talend API Tester using this Link

Once the Talend API Tester is configured, lets hit the API and see the response.

List of the Jira API - https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/application-properties-getProperty



Enter the URI for the API that you want to see the result for, mention the header parameter for authorization and prefix the token with “Basic” and enter the Token. Also, add one more Header Content-Type with "application/json" value.

Hit the send button and there you go. Hope you are successfully able to access the Rest API with this solution.


Post a Comment

Previous Post Next Post