Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve all Jira Asset IDs in a single request?

Hais_ Pedro May 12, 2025

I'm trying to fetch all Asset IDs from Jira in a single request to perform a FROM/TO mapping for an application, but I'm not able to retrieve them.
Could someone help me with this?
I need the ID shown in print1, and ideally I'd like to get all existing ones at once.

jira2.pngjira1.png

1 answer

0 votes
Trudy Claspill
Community Champion
May 12, 2025

Hello @Hais_ Pedro 

What have you tried?

There is an REST API endpoint that can be used to retrieve asset objects based on AQL

https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-aql-post

The endpoint allows you to specify the maximum number of results to return, but some REST endpoints cap that maximum so that the hosts cannot be overburdened by a request retrieving too many results. You may have to experiment with increasing the maxResults parameter to see how high you can push it.

Hais_ Pedro May 16, 2025

i have no idea, what i put in this query:
"qlQuery": "objectType = Office AND Name LIKE SYD"

Hais_ Pedro May 16, 2025

any example?

Hais_ Pedro May 16, 2025

Got it, but do i need any special permission? Should it be done via OAuth 2.0 authentication? I generated keys (OAuth 2.0), but i still getting a "Not Found response.

Hais_ Pedro May 16, 2025

I have used this app OAuth 2.0jira3.png

Trudy Claspill
Community Champion
May 16, 2025

How are you trying to execute the call?

What is the payload you are providing? Obscure your base URL and token information.

Hais_ Pedro May 19, 2025

jira4.png

Trudy Claspill
Community Champion
May 19, 2025

The API endpoint you have used is not the one I recommended.

https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-aql-post

The API endpoint you have specified does not appear to be in the documentation. The "Not found" response you are getting is because the endpoint is not found.

Can you provide a link to the documentation you referenced to get that endpoint?

Hais_ Pedro May 21, 2025

Well im try this way with Bearer that i get here:


curl -X POST https://auth.atlassian.com/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "authorization_code",
"client_id": "SEU_CLIENT_ID",
"client_secret": "SEU_CLIENT_SECRET",
"code": "SEU_AUTHORIZATION_CODE",
"redirect_uri": "http://localhost:8000/callback"
}'

 But i still get  "code": 401,
"message": "Unauthorized"jira5.png

Hais_ Pedro May 21, 2025

@Trudy Claspill when i inspect the page, i found other workspaceID diferent of the one i retrieve here:


https://api.atlassian.com/oauth/token/accessible-resources
jira6.png

Trudy Claspill
Community Champion
May 23, 2025

The accessible-resources endpoint provides IDs for Site IDs, as per

https://developer.atlassian.com/cloud/oauth/getting-started/making-calls-to-api/

You need an Asset Workspace ID. Use this API to get the workspace ID to use with Assets APIs

https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-assets/#api-rest-servicedeskapi-assets-workspace-get

Hais_ Pedro May 23, 2025

right, about the Bearer token, we have a way to get a token that don't expires? Or at least belong more time?

Also, its a bit annoying to get the token - having to make two requests an do it every hour, one to get the code and another to get the Bearer itself.


Hais_ Pedro May 23, 2025

For the assets API i receive this response: Client must be authenticated to access this resource.

Trudy Claspill
Community Champion
May 23, 2025

Your question about getting a token programmatically is not in line with what seemed to be your original topic - retrieving Jira Asset IDs.

I think you may find that the Developer Community has more knowledge related to development of interfaces to the Atlassian Cloud system. You can find a link to the Developer Community here:

https://developer.atlassian.com/cloud/assets/get-help/

Hais_ Pedro May 24, 2025

ok, but i wanna know how even with the managers authorization, i simply get a StatusCode: 401 Client must be authenticated"

jira7.png

Trudy Claspill
Community Champion
May 24, 2025

Developing an application including properly authenticating the user is outside my experience.

In the Developers Community there are people experienced with that.

Suggest an answer

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

Atlassian Community Events