Query for user details using the Jira Align REST API fails for legacy alphanumeric UIDs
Summary
Attempting to do a user lookup (GET query) using the Jira Align REST API fails if the user’s UID is alphanumeric.
Alphanumeric UIDs were generated for Jira Align users created in early versions of Jira Align. For example:
Environment
Jira Align
Diagnosis
- Using a GET call against the Users endpoint for an alphanumeric ID
- Results in Response = 400 Bad Request and “The value ##### is not valid”
Cause
This is expected behavior. The Jira Align API requires the ID for all elements, not the UID. This is an easy mixup given that the ID and UID values are the same for users created in more recent versions of Jira Align. For example:
Solution
A user’s ID should be used when performing an API lookup for the user. For example:
A user's ID can be obtained using one of the following methods:
- Modify the API call being used to query for all users ( /rest/align/api/2/users ) or for a specific user based on their last name ( /rest/align/api/2/users?filter=lastName eq '<name>' ). The resulting output will include the correct id information for the user(s)
- From Jira Align > Settings / Administration > People, use the More Actions button to Export the list of users and review the content of the exported information
- From Jira Align > Settings / Administration > People, open the User Details Panel and the browser address will show the ID value at end of the URL where MasterUserID=<ID>
Related Content:
References:
https://help.jiraalign.com/hc/en-us/articles/360045371954-Getting-started-with-the-REST-API-2-0