API guide: How to locate unknown users in your data

Tags: Flow

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?

 Core
Plus
 
   


Permissions

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:

  1. Click Settings in the Flow top navigation.
  2. Under User management in the left navigation bar, click Users.
  3. Click the user you want to have access.
  4. Click the Access tab.
  5. Under Management, select Manage My API Keys.
  6. 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:

  1. Click Settings.
  2. Click API keys in the left navigation.
  3. Click Interactive API documentation can be found here.

A new tab opens and you can see all your API endpoints.

back to top


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.

  1. Click on the very last endpoint, users.
  2. 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.
  3. Click Enter or click the Try it out! button at the bottom of the parameter list.
  4. 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.

back to top


Commits

Check to see if the unknown user has any commits recorded across any of your imported repos.

  1. 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.
  2. 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.
  3. 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.

back to top


Pull requests

If the commit's endpoint did not return any results. Continue the search in the pull request endpoint.

  1. Locate and click on the pull request endpoint.
  2. Find the apex_user_id parameter and paste in your user_id and click Enter or use the Try it out button.
  3. 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.

back to top


Tickets

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

back to top


Ticket events

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.

back to top


Next endpoints

If you could not locate any data in the above endpoints, continue searching across the remaining endpoints listed below.

  • ticket_comments
  • pull_request_events
  • pull_request_comments

back to top


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.

back to top


If you need help, please contact Pluralsight Support.