GoTo Developer

How to use GoToConnect API to fetch account users and lines

Prerequisites

This article assumes you can make API calls successfully which requires:

Note that we will use the terminology account in this guide instead of organization - the concept stays the same.

Fetch Accounts of the Authenticated User

You can use the /me from the Admin API to fetch the accounts of the authenticated user. Here we assume that the given token is the one of the super admins.

cURL Example

curl \
  'https://api.getgo.com/admin/rest/v1/me' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'Content-Type: application/json'

Successful Response Example

{
  ...
  "accounts": [
    {
      "key": "8887380153236031176710",
      "name": "My Great Account",
      ...
    },
    ...
    ,
    {
      "key": "88881601234581673744646",
      "name": "My Other Great Account",
      ...
    }
  ]
}

Note that a super admin could belong to more than one account.

List Users of an Account

Now that you have the account keys of the authenticated user, you can fetch a list of users and lines in these acccounts via the following API.

This API returns a list of all the users including their respective lines of the given account.

cURL Example

curl \
  'https://api.jive.com/users/v1/users?accountKey={accountKey}' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'Content-Type: application/json'

Successful Response Example

{
   "items":[
      {
         "userKey":"78888886011013972886849029",
         "lines":[
         ]
      },
      {
         "userKey":"764391408600712423079789789978",
         "lines":[
            {
               "id":"edc91481-cd84-4c7b-9067-0ab014c81032",
               "name":"Service test",
               "number":"1000",
               "organization":{
                  "id":"641860c6-9065-4d30-98e1-14aa4e6c59ec",
                  "name":"My Great Account"
               }
            }
         ]
      }
   ]
}