User APIs

Get User list

OVERVIEW

Overview

Get a list of users from Publisher

This API call is used to retrieve a list of users from the system.

Since v4.6

HTTP Request

GET  /api/2/users?{parameters}

URL Query Parameters
Parameter Format Description
organisations String Organisations, if more than one is specified, this should be in a comma separated list
organisationgroups String Organisation Groups, if more than one is specified, this should be in a comma separated list
usergroups String User Groups, if more than one is specified, this should be in a comma separated list
departments String Departments, if more than one is specified, this should be in a comma separated list
locations String Locations, if more than one is specified, this should be in a comma separated list. This will be a search across any of the fields within the Organisation location.
search String Will search across all user fields for a matching string. This should be the same search.
status  String Status:  active | archive | disable | suspended
sort String

Allow ascending and descending sorting for a single field.

GET /api/2/users?sort=-lastname

This returns a list of users sorted by descending lastname.

Possible fields: firstname, lastname, email, status, organisation, invited, last login, created, updated

fields String

To reduce the network traffic for mobile devices, we can reduce the number of fields returned.

If no fields are specified, a User summary Object will be returned for all users

If "all" is specified, the full User Object will be returned for all users

GET /api/2/users?fields=id,firstname,lastname,email

limit String

Limits the number of users returned.

GET /api/2/users?offset=10&limit=5

Default: 200

offset String

Allows paging of users.

GET /api/2/users?offset=10&limit=5

Default: 0

createddate String

Date String within a range. Possible values are:

  • "lastweek" 
  • "lastmonth" 
  • "lastyear" 
  • startDateYYYYMMDD,endDateYYYYMMDD (i.e. createdDate=20170801,20171004  would show Date range - 01 Aug 2017 to 04 Oct 2017)

GET /api/2/users?createdDate=lastweek

modifieddate String

Date String within a range. Possible values are:

  • "lastweek" 
  • "lastmonth" 
  • "lastyear" 
  • startDateYYYYMMDD,endDateYYYYMMDD (i.e. modifiedDate=20170801,20171004  would show Date range - 01 Aug 2017 to 04 Oct 2017)

GET /api/2/users?modifiedDate=lastweek

inviteddate String

Date String within a range. Possible values are:

  • "lastweek" 
  • "lastmonth" 
  • "lastyear" 
  • startDateYYYYMMDD,endDateYYYYMMDD (i.e. invitedDate=20170801,20171004  would show Date range - 01 Aug 2017 to 04 Oct 2017)

GET /api/2/users?invitedDate=lastweek

lastLogindate String

Date String within a range. Possible values are:

  • "lastweek" 
  • "lastmonth" 
  • "lastyear" 
  • startDateYYYYMMDD,endDateYYYYMMDD (i.e. lastLoginDate=20170801,20171004  would show Date range - 01 Aug 2017 to 04 Oct 2017)

GET /api/2/users?lastLoginDate=lastweek

HTTP Headers
HTTP Request Header Description Example
Authorization The API Authorisation token "Bearer XXXXXXXXXXXXX"
Accept

The format of the expected response. 

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the default response given.

"application/xml"
Content-Type

The format of the provided content.

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the expected content by default.

"application/json"

 

HTTP Response

Success

HTTP response 200 with a list of User summary Objects

(Example below)

 

Error

See API Error messages

Example HTTP Request & Response

Query:  (Organisations == (HighQ OR Law Firm)) AND (Locations == (London OR New York OR Ahmedabad))

GET http://example.com/context/api/2/users?organisations=HighQ,Law%20Firm&locations=London,New%20York,Ahmedabad

 

JSON Response

{

    "total": 2,   

    "currentpage": 0, 

    "users": [

        {

            "id": 3,

            "email": "user@domain.com",

            "link": "https://example.com/context/api/2/users/3"

        },

        {

            "id": 4,

            "email": "user2@domain.com",

            "link": "https://example.com/context/api/2/users/4"

        }

    ]

}

 

XML Response

<users>

    <total>2</total>

    <currentpage>0</currentpage>

    <user>

        <id>3</id>

        <email>user@domain.com</email>

        <link>https://example.com/context/api/2/users/3</link>
           
    </user>

    <user>

        <id>4</id>

        <email>user2@domain.com</email>

        <link>https://example.com/context/api/2/users/4</link>

    </user>

<users>

 

Comments


0 Comments

Last Updated: Nov 08,2024