rest api to correct get assets list and properties

Paolo Giacometti
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 28, 2024

Dear All,

 

I have all my assetts loaded in JIRA and I am coding a powershell script that sync this assetts with other softwares (like AD).

I was able using the rest api to query the list of objects but unfortunately I am not abe to get all properties of the single object (extended and in this case the object is a sim card).

Documentation seems laking to me on the subject could you pls point me out some link or github where I can have a starting point?

 

Thanks to all in advance

 

Paolo Giacometti

1 answer

0 votes
Hector Florin
Contributor
November 28, 2024

Hi Paolo,

Welcome to the Community. I hope you're doing well.

Reviewing Atlassian Dev documentation, I see that extended was deprecated, and they recommend using includeTypeAttributes it instead

http://localhost:8100/rest/assets/1.0/aql/objects?includeTypeAttributes=true

 

https://docs.atlassian.com/assets/REST/10.4.4/#aql-findObjects

I hope it helps.

Thank you.
Hector

Hector Florin
Contributor
November 28, 2024

I see now that you've raised the question for Jira Cloud, not DC. I'm sorry for misreading it.

For Jira Cloud the Asset REST API documentation shows 

https://developer.atlassian.com/cloud/assets/assets-rest-api-guide/workflow/

 

Then, you can do a POST to the "/object/aql" endpoint, which is the option to use now.

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

 

Thank you.
Hector

Paolo Giacometti
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 28, 2024

Thanks Hector,

I already arrived at point 2 using the post method in the endpoint. But the list I get I cannot understand how to get the single object detail

Hector Florin
Contributor
November 28, 2024

Hi Paolo,

Thank you for your response.

you get the following structure, 

first level, contains the total results and includes a "Values" structure

"startAt":0,
"maxResults":25,
"total":2,
"values": [..., ...]               <---------
"objectTypeAttributes": [..., ...],
"hasMoreResults":false,
"last":true,
"isLast":true


This structure contains your assets returned from the AQL

"workspaceId":"500dasd-af5d-9d742bc8807c",
"globalId":"500dasdasdasda42bc8807c:1",
"id":"1",
"label":"LG 7000",
"objectKey":"GAD-1",   <<<<<-------here you have the object key that you can match
"avatar",
"objectType", [..., ...]        
"created":"2024-11-28T22:22:02.651Z",
"updated":"2024-11-28T22:22:53.197Z",
"hasAvatar":false,
"timestamp":1732832573197,
attributes [..., ...]               <<<<<<,----------- here you have your attributes
_links []
"name":"LG 7000"

 

The attributes will be structured the following way 

"workspaceId":"500dasd-af5d-9d742bc8807c",
"globalId":"500dasdasdasda42bc8807c:1",
"id":"9",
"objectTypeAttributeId":"85",
objectAttributeValues  [..., ...]  ,   <<<<<----- and in here, you finally have it
"objectId":"1"

 

The value of the attribute will be included as follows

"value":"42",
"searchValue":"42",
"referencedType":false,
"displayValue":"42"

 

As you can see, here you have an asset object (GAD-1) which is an LCD Screen (object type), with details 
name = LG 7000

size = 42

I hope this helps you understand It better.


Thank you.
Hector

Suggest an answer

Log in or Sign up to answer