Flow ingests any user associated with an imported repo or project. Users can be associated to imported repos and projects via commits, comments, ticket subscriptions etc. Because Flow ingests users associated to repos and projects in multiple ways, you may not recognize every ingested user. This article shows you how to use the API to locate where a user was ingested from.
Who can use this?
You need the Manage my API keys and API access permissions to locate unknown users in you data. First, let's make sure you have access to the API and all its endpoints. You will need Manage API keys and API access permissions.
To set these permissions:
- Click Settings in the Flow top navigation.
- Under User management in the left navigation bar, click Users.
- Click the user you want to have access.
- Click the Access tab.
- Under Management, select Manage My API Keys.
- Under API access, click Select All.
You've now set your API permissions set and can access the API and its endpoints.
To access the API documentation:
- Click Settings.
- Click API keys in the left navigation.
- Click Interactive API documentation can be found here.
A new tab opens and you can see all your API endpoints.
Locate the user ID
To locate a user's associate work, you must identify the unknown user's user_id. We can use that to locate any work they are associated with.
- Click on the very last endpoint, users.
- A list of available parameters appears. Locate the user_id with the name or email of the user. Type in the name or email of the unknown user in the appropriate field. In this example we are using the email address.
- Click Enter or click the Try it out! button at the bottom of the parameter list.
- If you have typed in the name or email correctly, you will see a result set like this for the unknown user. The user_id we need will be listed at the top of the results next to the parameter id. Copy this number to your clipboard. We will use this in the following steps.
Now that you have the user_id, we can locate any work that has been imported for this user.
Check to see if the unknown user has any commits recorded across any of your imported repos.
- Scroll to the top of your API endpoint list and click on commits, then click the top GET URL. This opens the list of parameters for the commits endpoint.
- Locate the parameter apex_user_id towards the bottom of your parameter list. Paste in the user_id you copied in the last section and click Enter or use the Try it out! button to run the query.
- If any results appear, you can identify what commits the unknown User authored by locating the external_commit_url. This will take you into your Git host to review the work further. If there are commits for this User, the results will look like this.
You found the source of your unknown user. Count is the total number of records and commits found. Hexsha is the commit sha from Git host.
If there were 0 commits found for this user, your response will look like this.
If the commit's endpoint did not return any results, look for the unknown user via Pull requests.
If the commit's endpoint did not return any results. Continue the search in the pull request endpoint.
- Locate and click on the pull request endpoint.
- Find the apex_user_id parameter and paste in your user_id and click Enter or use the Try it out button.
- Upon running your query you will either see results or you will not. If 0 PRs were found, continue to the next endpoint. If results were found for this unknown user, you have identified the origin source for the user.
If you have a ticket integration or use your Git host tickets and issues you can look for your unknown user in the tickets endpoints. Ticket endpoints require a user_alias_id. These are the aliases merged under the apex_user. You should try the apex_user_id and any user_alias_ids to locate tickets, ticket events and/or ticket comments this unknown User may have made.
- Under the user_alias endpoint locate the apex_user field and paste the user_id you have been using in the previous steps. Click Enter or click the Try it out button.
- The results show you all the aliases found for this apex_user. Count is the total number of aliases found for the user. Copy and save all id's for later use. Id is user_alias_id.
- Now that we have all user_alias_ids for our unknown user, locate any tickets. Open the tickets endpoint and locate the created_by_id field.
- Copy one of the user_alias_ids you saved from Step: 2 and click Enter or Try it out! to see if any records are found. Swap out each user_alias_id and try the apex_user_id. The original ID we got at the beginning of this guide. If records are not found, continue on to the next endpoint.
Locate and click on the ticket_eventsendpoint. Find the user_alias_id field and paste in one of your user_alias_ids. You can also utilize the user_alias_id__in field and paste in all your user_alias_id's separated by a comma. This will look for any record across any of the ID's you input. Click Try it out to see the results.
If you could not locate any data in the above endpoints, continue searching across the remaining endpoints listed below.
I did not find any data for the user
If you did not find any data in your account for this user, the data may have been deleted or removed from your account. This can happen if the repo or project was removed from your Flow account. You should be able to delete this user as there is no data tying them to your account.You can do this on the User page.
If you need help, please contact Pluralsight Support.