Additional response parameters of the API (for e.g., added_to_org
) are available only to customers using the new user management experience. Learn more about the new user management experience.
Specifications:
product_access
response field will be empty.To complete this tutorial, you need the following:
API token ≠ API key:
AccountId is a required path parameter to get last active dates of a user.
An API token is needed to get the accountId in the next step. Use the API token to authenticate your script.
To create an API token:
To get the accountId:
Use the Jira User Search API with the API token and Basic authentication to get the accountId: GET /rest/api/3/users/search
.
1 2curl --request GET \ --url 'https://your-domain.atlassian.net/rest/api/3/users/search' \ --user 'email@example.com:<api_token>' \ --header 'Accept: application/json'
Search the results by email address or name of the user to find the correct accountId.
Learn more about the Jira API.
If you don’t have Jira, export a .csv of the user list. Learn how to export users from a site
The User's last active dates script, uses an API key as a Bearer access token. It also uses the Organization ID field as a path parameter.
To create an API key and get the Organization ID:
Learn more about the API keys.
Use the accountId, API key and Organization ID from the previous steps to get users last active dates: GET /admin/v1/orgs/{orgId}/directory/users/{accountId}/last-active-dates
1 2curl --request GET \ --url 'https://api.atlassian.com/admin/v1/orgs/{orgId}/directory/users/{accountId}/last-active-dates' \ --header 'Authorization: Bearer <access_token>'
Response: check last_active field in the response for each product in the list.
1 2{ "data": { "product_access": [{ "id": "ari:cloud:jira-software::site/58d24034-e3ec-11ed-b5ea-0242ac120002", "key": "jira-software", "last_active": "2023-01-19" }, { "id": "ari:cloud:confluence::site/58d24034-e3ec-11ed-b5ea-0242ac120002", "key": "confluence", "last_active": "2023-01-12" }], "added_to_org": "2023-01-11" }, "links": { "next": null } }
If the user has not accessed a product, the product_access
response field will be empty. The added_to_org
field is available only to customers using the new user management experience. Learn more about the new user management experience.
For more details about the Organization's products, for example to look up the product's URL, use Org Workspaces APIs.
Pagination: The following example demonstrates how to use the cursor received in the links response to fetch the next page.
1 2curl --request GET \ --url 'https://api.atlassian.com/admin/v1/orgs/{orgId}/directory/users/{accountId}/last-active-dates?cursor={next}' \ --header 'Authorization: Bearer <access_token>'
Make your first request and get started with the User's last active dates API and get more information on error codes.
Rate this page: