Users
Users represent users in the system.
A user is a member of a company with various permissions to diffferent resources.
A user record holds the following information:
- id
- contact_id
- company_id
- first_name
- last_name
- name
- locale
- initials
- roles
- signature
Getting Users
GET (/api/v2/system/users/:id()
Using curl
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users \
-v -u (login):(password) -X POST
Using php
<?php
$credentials = 'username:password';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users/123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
Example response
{
"company_id": 1,
"contact_id": null,
"email": "john@acme_systems.com",
"first_name": "John",
"id": 123,
"last_name": "Bloggs",
"locale": "en",
"name": "John Bloggs"
}
statuscode 200
no error
statuscode 404
does not exist
Getting more than one user
GET (/api/v2/system/users()
Using curl
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users \
-k -u (login):(password)
Using php
<?php
$credentials = 'username:password';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
Example response
[
{
"company_id": 1,
"contact_id": null,
"email": "john@acme_systems.com",
"first_name": "John",
"id": 123,
"last_name": "Bloggs",
"locale": "en",
"name": "John Bloggs"
},
{
"company_id": 1,
"contact_id": null,
"email": "jerry@acme_systems.com",
"first_name": "Jerry",
"id": 124,
"last_name": "Smith",
"locale": "en",
"name": "Jerry Smith"
}
]
statuscode 200
no error
statuscode 404
does not exist
Filtering
The results for a list of accounts can be filtered. See Filtering
Creating Users
Currently, only the creation of LMS users is available via API. If an attempt to set the user type to anything other than ‘LMS’ is made, the action will be denied and an error 403 will be returned. Future user types will be added as functionality of the API is updated.
POST (/api/v2/system/users()
Using curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users
-v -u (login):(password) -X POST
Using php:
<?php
$credentials = 'username:password';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users';
$post = array(
'first_name' => 'Anne',
'last_name' => 'Smith',
'locale' => 'en',
'company_id' => 1,
'contact_id' => 100
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
Example response
{
"company_id": 1,
"contact_id": 100,
"email": "john@acme.com",
"first_name": "Anne",
"id": 124,
"last_name": "Smith",
"locale": "en",
"name": "Anne Smith"
}
NOTE: first_name is now ‘other’
statuscode 200
no error
statuscode 404
could not create
Updating users
POST (/api/v2/system/users/:id()
Using curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users/:id
-v -u (login):(password) -X POST
Using php:
<?php
$credentials = 'username:password';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/users/123';
$post = array(
'name' => 'other',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
Example response
{
"company_id": 1,
"contact_id": null,
"email": "john@acme.com",
"first_name": "other",
"id": 123,
"last_name": "Smith",
"locale": "en",
"name": "other Smith"
}
NOTE: first_name is now ‘other’
statuscode 200
no error
statuscode 404
could not create