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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you very much for your information. I was able to use below to retrieve the specific object using label, instead of username.
However, I am having issue with create an asset object using below:
https://api.atlassian.com/jsm/assets/workspace/xxxxxx/v1/object/create, i am getting 401 unauthorized error but it wa confirmed the user making the connection does have write permission. I am not sure exact what parameters I should be using. is basic authorization correct? useraccount: password? or username: apitoken when making connection?
thank you very much!
Wendy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Wendy Wei Try using the API token for the script. Basic auth is fine.
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.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.