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

Submitting Deployment data through API via Postman

Amjad October 11, 2020

Submitting deployment  data retruns [ { "message": "Resource must be JWT authenticated." }].

Any help in setting up JWT authentication with exact values for callback, client id and secret value will be of great help, as an example from where to capture this data. Tried with previous articles but those are incomplete.

4 comments

Comment

Log in or Sign up to comment
Amjad November 25, 2020

Any updates or solution for this. I am getting same msg.

Bradley McCrorey June 7, 2021

This is pretty old - any updates, gang?

christopher_garstin February 24, 2022

I'm running into this as well, and it looks like the deployments API can only be accessed using OAuth 2.0 or JWT.  JWT is specific to Connect Apps, which Postman is not, and sadly it looks like when trying to create an OAuth token in Postman, it's callback URL is not allowed by Jira.

Danilo Cereda March 2, 2022

Hey @Amjad

CC: @Bradley McCrorey , @christopher_garstin 

 

This is beacause you need to be Oauth2 authenticated first, so the problem will be split in 2 steps:

1- Retrieve an authentication token (Bearer) from Atlassian auth service (https://api.atlassian.com/oauth/token). I was able to complete this step after a lot of research (see solution bellow).

2- Call Deployment API to submit deploy data (I'm on it, but even with a valid Bearer token couldn't manage to make it work yet).

 

I hope unblocking you in the first step can clarify what I'm doing wrong in the seccond step. This sollution is for testing in Postman but I implemented it in python after postman PoC was working.

First step:

1. Send the token request:

 

curl --location --request POST 'https://api.atlassian.com/oauth/token' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic ZGFuaWxvLmNlcmVkYS1leHRAYWItaW5iZXYuY29tOkNAcGltMjAyMWFiaQ==' \
--data-raw '{
    "audience""api.atlassian.com"
    "grant_type":"client_credentials",
    "client_id""CLIENT_ID",
    "client_secret""CLIENT_SECRET"
}'
2. Sending it you'll receive the auth bearer token in the response:
{
    "access_token""TOKEN_STRING",
    "scope""manage:jira-data-provider",
    "expires_in"3600,
    "token_type""Bearer"
}

 

Step 2:

Send the deployment data request (with received token):

 

curl --location --request GET 'https://your-domain.atlassian.net/deployments/0.1/pipelines/X/environments/Y/deployments/Z' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN_STRING'
Unfortunally I stuck in this step receiving an Auth error 403 even with a valid token. But for sure it will help since I lost a lot of time to pass step 1.
Hope it helps and let me know if you've able to complete step 2 :)
Best regards,
Danilo
Deleted user September 16, 2022

Hey Danilo, thanks for the code snippets. From where do you obtain CLIENT_ID & CLIENT_SECRET information which was used for getting the token?

Volodymyr Melnyk October 2, 2023

Thanks to your comment! I was able to go further with research and found the right documentation at https://developer.atlassian.com/cloud/jira/software/integrate-jsw-cloud-with-onpremises-tools/

 

Hope it helps 

TAGS
AUG Leaders

Atlassian Community Events