Hi everyone, hope you're all fine
I'm trying to get assets based on their names, customfield values, etc., but I can perform a correct filter, I receive all the assets or none...
I have used the AQL Api
I'm trying to perform an API call with Python 3 to this URL:
url = "https://api.atlassian.com/jsm/assets/workspace/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/v1/aql/objects?qlQuery= objectTypeId = XX AND Status = 'OPERATIVE'"
But is not working, not asset is retrieved...
Could you give me a hand with this? Please
It would be great if you can write down an URL example with a field and a customfield (so I could see how to approach), please
I have no found useful example in the documentation...
Thank you so much for your time!
For anyone wondering what is the problem.
The AQL API uses qlQuery
The problem was... that I was doing:
"....qlQuery=objectTypeId = XX AND Status = 'OPERATIVE'"
And it has to be:
'...qlQuery=objectTypeId = XX AND Status = "OPERATIVE"'
So... the texts have to use "" and not ''
And that's it ;)
Ahh, I hadn't noticed that.
PS. In all of Atlassian's query languages, you only need double inverted commas around the field object if it has spaces in its name. This works just as well:
'...qlQuery=objectTypeId = XX AND Status = OPERATIVE'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! I always double quote them because I make the API calls from an API and the values passed could be one or two words, so, just in case
But is good to know for the harcoded or fixed parts, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In addition to what @Hana Kučerová said, try without the space after the qlQuery= or aqlQuery= parameter:
url = "https://api.atlassian.com/jsm/assets/workspace/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/v1/aql/objects?qlQuery=objectTypeId = XX AND Status = 'OPERATIVE'"
as it might be interpreted as an empty query and the endpoint is then just ignoring everything thereafter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David! Thank you for your fast reply
I have tested various things, and finally found how to make it work, I'll explain:
Yes, the AQL API uses qlQuery
Space or not space after the qlQuery parameter doesn't matter
The problem was... that I was doing:
"....qlQuery=objectTypeId = XX AND Status = 'OPERATIVE'"
And it has to be:
'...qlQuery=objectTypeId = XX AND Status = "OPERATIVE"'
So... the texts have to use "" and not ''
Thank you so much for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ian Carlos ,
it seems to me strange, that the parameter would be called qlQuery instead of aqlQuery.
Maybe it is nonsense, but would please try it with aqlQuery?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hana! Thank you for your fast reply
I have tested various things, and finally found how to make it work, I'll explain:
Yes, the AQL API uses qlQuery
The problem was... that I was doing:
"....qlQuery=objectTypeId = XX AND Status = 'OPERATIVE'"
And it has to be:
'...qlQuery=objectTypeId = XX AND Status = "OPERATIVE"'
So... the texts have to use "" and not ''
Thank you so much for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for letting us know!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.