GoTo Developer

How to create, update and delete account users via Admin API

Prerequisites

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

Note that we will use the term account in this guide instead of organization - the concept stays the same.
Also, you should be aware that any user modification performed via the Admin API to your account is automatically reflected to your pbx (organization).

Create Users of an Account

You can use the Add Users operation available in the Admin API to create users of an account. Here we assume that the given token is the one of the super admins.

Required request parameters for this operation are:

  • accountKey: The account key. If no value is provided, it uses the admin's default account key.
  • users: An array of objects that holds the users to be added to the account.

Request Payload

This is a sample request payload that shows some attributes available in a User record.

{
  "users": [
    {
      "email": "jtianno@company.com",
      "firstName": "Janco",
      "lastName": "Tianno"
    }
  ],
  "suppressEmail": true
}

suppressEmail controls whether a welcome email is sent. The email invites the user to setup their login credentials and notifies them of access to the account. If you would like to prevent the user from being notified about being added to the LogMeIn account you may set "suppressEmail":true in the request.

cURL Example

curl -X POST \
  'https://api.getgo.com/admin/rest/v1/accounts/{accountKey}/users' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'Content-Type: application/json' \
  -d '{"users":[{"email":"jtianno@company.com","firstName":"Janco","lastName":"Tianno"}]}'

Successful Response Example

Response payload contains a list of records with attributes userKey and email.
Existing (conflicting) users are returned in the response payload as well.

[
  {
    "key": 78888886011013972886849029,
    "email": "jtianno@company.com"
  }
]

Errors

Validation errors are returned as HTTP 400 - Request validation errors as exhibited in the following sample.

{
  "code": "user.timezone.invalid",
  "field": "users[n].timeZone"
}

Update Users of an Account

You can use the Update User operation available in the Admin API to update a user of an account. Here we assume that the given token is the one of the super admins.

Required request parameters for this operation are:

  • accountKey: The account key. If no value is provided, it uses the admin's default account key.
  • userKey: The user key. Expected to be an integer value.

Request Payload

This is a sample request payload that shows some attributes that can be modified in a User record.

{
   "email": "jtianno@company.com",
   "firstName": "Janco",
   "lastName": "Tianno"
}

cURL Example

curl -X PUT \
  'https://api.getgo.com/admin/rest/v1/accounts/{accountKey}/users/{userKey}' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'Content-Type: application/json' \
  -d '{"email":"jtianno@company.com","firstName":"Janco","lastName":"Tianno"}'

It is expected that an HTTP 204 No Content is returned as a successful response.

Delete Users of an Account

You can use the Delete User operation available in the Admin API to remove a list of users of an account. Here we assume that the given token is the one of the super admins.

Required request parameters for this operation are:

  • accountKey: The account key. If no value is provided, it uses the admin's default account key.
  • userKeys: The user keys. Expected to be an array of integer values. Can be provided as a comma separated string.

Note that the user will only be removed from the account. User credentials to login will still work, they will just not have access to the given account.

cURL Example

curl -X DELETE \
  'https://api.getgo.com/admin/rest/v1/accounts/{accountKey}/users/{userKeys}' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'Content-Type: application/json'

It is expected that an HTTP 204 No Content is returned as a successful response.