Choose a language javascript

Users

The users object represents users of our system within your organisation, typically members of staff.

An example User Object

{
"id": "744ca408-2bbd-4d33-9bb0-329b880e2f72",
"email": "tom@felloh.com",
"mobile": null,
"status": "ACTIVE",
"first_name": "Tom",
"last_name": "Jones",
"created_at": "2022-01-28T12:33:45.617Z",
"updated_at": "2022-01-28T12:33:45.617Z"
}

An example compact user object

{
"id": "744ca408-2bbd-4d33-9bb0-329b880e2f72",
"email": "tom@felloh.com"
}

idstring

Unique identifier for the user object.

emailstring

The email address of the user

mobilestring

The mobile phone number of the user (used for two-factor authentication)

first_namestring

The first name of the user

last_namestring

The last name of the user

created_atdatetime

The datetime at which the user was created within our systems

updated_atdatetime

The datetime at which the user was last updated.


List all users

Request

const kittn = require('kittn');
let api = kittn.authorize('meowmeowmeow');
let kittens = api.kittens.get();
curl "http://example.com/api/kittens"
-H "Authorization: meowmeowmeow"
const kittn = require('kittn');
let api = kittn.authorize('meowmeowmeow');
let kittens = api.kittens.get();

Response

[
{
"id": 1,
"name": "Fluffums",
"breed": "calico",
"fluffiness": 6,
"cuteness": 7
},
{
"id": 2,
"name": "Max",
"breed": "unknown",
"fluffiness": 5,
"cuteness": 10
}
]

This endpoint retrieves all kittens.

HTTP Request

GET http://example.com/api/kittens

Query Parameters

ParameterDefaultDescription
include_catsfalseIf set to true, the result will also include cats.
availabletrueIf set to false, the result will include kittens that have already been adopted.

Retrieve a user

const kittn = require('kittn');
let api = kittn.authorize('meowmeowmeow');
let max = api.kittens.get(2);
curl "http://example.com/api/kittens/2"
-H "Authorization: meowmeowmeow"
const kittn = require('kittn');
let api = kittn.authorize('meowmeowmeow');
let max = api.kittens.get(2);

The above command returns JSON structured like this:

{
"id": 2,
"name": "Max",
"breed": "unknown",
"fluffiness": 5,
"cuteness": 10
}

This endpoint retrieves a specific kitten.

HTTP Request

GET http://example.com/kittens/<ID>

URL Parameters

ParameterDescription
IDThe ID of the kitten to retrieve