How to filter users in provisioning SCIM using REST API
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Filtering users based on userName and externalID in user provisioning SCIM using API.
Environment
User provisioning integration with Atlassian organization.
Solution
Run the Get users SCIM REST API to fetch all users from the user provisioning directory at Atlassian organization.
Example:
curl --request GET \ --url 'https://api.atlassian.com/scim/directory/{directoryId}/
Users' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
In this example,
- directoryID: This is the ID of the user provisioning directory created at Atlassian organization.
- access_token: This is the API token generated for the user provisioning directory.
This API will provide a list of all the users and may be difficult to navigate to the exact user details one might be looking for. To further refine your output, you can filter the API results based on two parameters:
userName: This is the user name of the user in the Active directory.
externalID: This is the objectID / userID of the user mapping in the Active directory.
Example: Filtering with userName
curl --request GET \
--url 'https://api.atlassian.com/scim/directory/{directoryId}/
Users?filter=userName%20eq%20"username@example.com"' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
Example: Filtering with externalID
curl --request GET \
--url 'https://api.atlassian.com/scim/directory/{directoryId}/
Users?filter=externalID%20eq%20"externalID of user"' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
This will provide you with a filtered response for specific user details.