Download all assets by aql
Asked by Roman Kern:

OK, it seems that community will/can not help. Guess the main problem ist the check of the request token validity, since the request was not created by the url I've put into the dev portal

Hello,

it is possible to download all assets by AQL without OAuth 2? I know that the basic API is deprecated. The OAuth process is not made for automations (external access to jira). Currently I'm just facing the problem with athentication/authorization. I can create a bearer token, but API returns 401

**Do someone have any clues?**

POST <https://api.atlassian.com/jsm/assets/workspace/>{{WorkspaceId}}/v1/object/navlist/aql

body  
{  
"objectTypeId": "296",  
"page": 1,  
"asc": 1,  
"resultsPerPage": 25,  
"includeAttributes": false,  
"objectSchemaId": "7",  
"qlQuery": "some query bla bla"  
}

Response:

{"code":401,"message":"Unauthorized"}

{  
"kid": "auth.atlassian.com-ACCESS-\*",  
"alg": "RS256"  
}.{  
"jti": "d\*",  
"sub": "\*",  
"nbf": 1709305554,  
"iss": "<https://auth.atlassian.com>",  
"iat": 1709305554,  
"exp": 1709309154,  
"aud": "\*",  
"<https://atlassian.com/systemAccountEmail>": "\*@connect.atlassian.com",  
"client_id": "\*",  
"<https://id.atlassian.com/atl_token_type>": "ACCESS",  
"<https://atlassian.com/firstParty>": false,  
"<https://id.atlassian.com/ujt>": "\*",  
"<https://atlassian.com/verified>": true,  
"<https://id.atlassian.com/processRegion>": "us-east-1",  
"<https://id.atlassian.com/session_id>": "\*",  
"<https://atlassian.com/orgId>": "\*",  
"<https://atlassian.com/3lo>": true,  
"<https://id.atlassian.com/verified>": true,  
"<https://atlassian.com/emailDomain>": "\*",  
"scope": "read:cmdb-object:jira read:cmdb-schema:jira read:cmdb-type:jira read:cmdb-attribute:jira",  
"<https://atlassian.com/systemAccountId>": "\*",  
"<https://atlassian.com/oauthClientId>": "\*",  
"<https://atlassian.com/systemAccountEmailDomain>": "connect.atlassian.com"  
}.\[Signature\]

the accessible resource should be fine

<https://api.atlassian.com/oauth/token/accessible-resources>  
\[  
{  
"id": "\*\*\*-37d6-4931-a7b9-\*\*\*",  
"url": "https://\*.atlassian.net",  
"name": "\*",  
"scopes": \[  
"read:cmdb-object:jira",  
"read:cmdb-schema:jira",  
"read:cmdb-type:jira",  
"read:cmdb-attribute:jira"  
\],  
"avatarUrl": "<https://site-admin-avatar-cdn.prod.public.atl-paas.net/avatars/240/flag.png>"  
}  
\]


Answers:
author: Roman Kern
body: can someone help? Do anyone use the API at all?


author: Joseph Chung Yin
body: [@Roman Kern](/t5/user/viewprofilepage/user-id/5442545) -

Welcome to the community, please see this reference on how to use Token for REST APIs auth -

<https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/>

the token needs to be passed as a header value -H "Authorization: Bearer \<Token\>"

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

comments: author: Roman Kern
body: sorry, the basic token api is deprecated, won't work


author: Joseph Chung Yin
body: [@Roman Kern](/t5/user/viewprofilepage/user-id/5442545) -

If you use my suggestion on the syntax using the Bearer token, then it will work.

Best, Joseph


Tags: cloud

jira

jira-cloud

jira-service-desk-cloud

zzz