Hello,
I need to update a jira user object under assets via API call. How do I find the user object id based on username or email via API call?
Any suggestion or idea is highly appreciated.
Thank you
Wendy
@Wendy Wei Below steps should get you accomplish the requirement.
@Gikku thank you for the information. However, I cannot get expected result using below url, it still retrieve 25 users as pageObhectSize, not just the specific one:
https://api.atlassian.com/jsm/assets/workspace/XXXXXXXXX..../v1/aql/objects?qlQuery=objectschemaId=4&objectTypeId=6&username="Wendy.Wei@xxx.com". In addition, i got 405 method not allowed error when using either post or put. but using Get does return results, just not a single result.
Any idea?
@Gikku any suggestions?
thanks,
@Wendy Wei The query should be corrected as 'objectSchemaId' and you can also verify the results by running the same search from the UI to see if you are getting the intended results.
Here is a sample code that I am using with Scriptrunner.
*******
def ASSETS_WITH_TAGS_AQL = 'objectSchemaId=1 AND objectTypeId=2 AND Tag IS NOT EMPTY'
def getDevicesWithUsername = {post("https://api.atlassian.com/jsm/assets/workspace/${WORKSPACE_ID}/v1/object/aql?maxResults=10&includeAttributes=false").basicAuth(ASSETS_ACCOUNT, ASSETS_TOKEN).header('Content-Type', 'application/json').body([qlQuery: "${ASSETS_WITH_TAGS_AQL}"]).asObject(Map).body.values as List}
It looks like you're new here. Sign in or register to get started.