Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,097
Community Members
 
Community Events
168
Community Groups

Submitting Deployment data through API via Postman

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

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

This is pretty old - any updates, gang?

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.

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

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

Comment

Log in or Sign up to comment