Get Users (master token)
POST https://{{base_url}}/graphql
Get all users including their name, id, and externalUserId.
Use example requests from the right to try simple local tests with curl, js, python etc. (note you will still be interacting with live data when using master and user tokens!)
You can find example usage of this as a backend-only API in our Embedded sample app (remember that client-side Javascript calls to the API will be blocked by CORS):
- The
users
query is setup in server/graphql.js so it can then be called at any point withqueries.users
Required Token | Notes |
---|---|
Master | obtained from the Tray app UI under settings. Only admins and owner have access to the tokens tab. |
The query accepts the following filter criteria:
Criteria | Notes |
---|---|
userId | obtained with Mutations/Users/Create New User |
externalUserId | used to link the End User to an ID you have already set for them in your external database |
It can return the following data:
Returned Data | subfields | Notes |
---|---|---|
name | ||
id | Tray ID of the user | |
externalUserId | unique id for the user in your database | |
cursor | used for pagination | |
pageinfo | hasNextPage, endCursor, hasPreviousPage, startCursor | used for pagination |
RESPONSES
status: OK
{"data":{"users":{"edges":[{"node":{"name":"Dwight Schrute","id":"1a71daf1-XXXX-XXXX-XXXX-dbb4ab325a55","externalUserId":"324776789-XXXX-XXXX-XXXX-343fd323"},"cursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1"},{"node":{"name":"Pam Beesly","id":"23432k3j-XXXX-XXXX-XXXX-dbb4ab32223a","externalUserId":"234322323-XXXX-XXXX-XXXX-343fd323"},"cursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1"},{"node":{"name":"Jim Halpert","id":"3497654k-XXXX-XXXX-XXXX-db353534kjh","externalUserId":"0998759-XXXX-XXXX-XXXX-3435678d"},"cursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1"},{"node":{"name":"Angela Martin","id":"09078943d-XXXX-XXXX-XXXX-dbcisij392","externalUserId":"9689843832-XXXX-XXXX-XXXX-35387djh32"},"cursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1"},{"node":{"name":"Kevin Malone","id":"fhfd34643-XXXX-XXXX-XXXX-4534sdg46","externalUserId":"4673213d-XXXX-XXXX-XXXX-jtg5642s4"},"cursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1"}],"pageInfo":{"hasNextPage":false,"endCursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1","hasPreviousPage":false,"startCursor":"MWE3MWRhZjEtOTdiYS00MDM2LWE1Y2MtZGJiNGFiMzI1YTU1"}}}}