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

Using the AQL API to query assets

Wade H November 14, 2022

Can anyone guide me on using an aql query to get a list of asset objects?
right now i am trying this:
/v1/aql/objects?objectSchemaId=5&objectTypeId=15

however it does not narrow down the return of just the objects that have an objectTypeId of 15.

thanks,
-wade

1 answer

1 accepted

6 votes
Answer accepted
Wade H November 15, 2022

In case anyone is interestred this is what I got to work

/v1/aql/objects?qlQuery=objectSchemaId=5 and objectTypeId=15

Iker Gómez Eiras February 8, 2023

My god, THANK YOU!!

The absolute lack of query examples in the official documentation is frustrating to the point of anger, specially since in IQL the objectSchemaID had to be specified before the actual query.

Thank you, thank you, thank you!!

Like # people like this
Wade H February 8, 2023

you are welcome!! 

Paul Hecker February 20, 2023

Hello Wade,

First, and most importantly, "Thank you!" for your post.  It was the only information I could find referring to the use of the "qlQuery" REST API option.

For anyone else searching, with the assistance of Atlassian Support I was able to sort out my AQL query and perhaps someone may find it useful as well.

I was trying to use the REST API to run a Curl query against the Assets CMDB to find objects that met a criteria where the Serial Number attribute started with a specific text string. 

EX: objectSchemaId = 7 AND objectTypeId = 22 AND "serial number" startsWith emea

The short answer was that I did not encode my query properly to be used in a URL.  Where ""https://api.atlassian.com/jsm/assets/workspace/{workspaceId}/v1/aql/objects?qlQuery=objectSchemaId = 7 AND objectTypeId = 22 AND "serial number" startsWith emea"" did not work, ""https://api.atlassian.com/jsm/assets/workspace/{workspaceId}/v1/aql/objects?qlQuery=objectSchemaId%20%3D%207%20AND%20objectTypeId%20%3D%2022%20AND%20%22serial%20number%22%20startsWith%20emea"" did work.

I hope others find this information helpful.

Like Mario Herranz likes this
Wade H February 21, 2023

Good information @Paul Hecker I came across that as well when using the api call in a groovy script. It does not like spaces. :)

Suggest an answer

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

Atlassian Community Events