User Group APIs

Get User Group list

OVERVIEW

Overview

Get a list of user groups from Publisher

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

Since v4.6

HTTP Request

GET  /api/2/groups?{parameters}

 

URL Parameters
Parameter Format Description
search String Will search across all user group fields for a matching string. This should be the same search as the top of the user groups admin page
sort String

Allow ascending and descending sorting over multiple fields.

GET /groups?sort=-name,+created

This returns a list of groups sorted by descending group name and ascending created date.

possible fields: name, 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 Group Summary object will be returned for all user groups

If "all" is specified, the full User Group object will be returned for all user groups

GET /groups?fields=id,name

limit String

Limits the number of groups returned. 

GET /groups?offset=10&limit=5

Default: 200

offset String

Allows paging of groups.

GET /groups?offset=10&limit=5

Default: 0

createdDateTime 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/groups?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/groups?modifiedDate=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 Group Summary Objects

(Example below)

 

Error

See  API Error messages 

 

Example HTTP Request & Response

Query String:  (Search = "corp" AND sort by created)

GET http://example.com/context/api/2/groups?search=corp&sort=+created

 

JSON Response

{

    "total": 4,   

    "currentpage": 0,  

    "groups": [

        {

            "id": 3,

            "name": "Super Mega Hyper Corp",

            "link": "http://example.com/context/api/2/groups/3"

        },

        {

            "id": 4,

            "name": "ABC Corporate",

            "link": "http://example.com/context/api/2/groups/4"

        }

    ]

}

 

 

XML Response

<groups>

    <total>4</total>

    <currentpage>0</currentpage>

    <group>

        <id>3</id>

        <name>Super Mega Hyper Corp</name>

        <link>http://example.com/context/api/2/groups/3</link>
           
    </group>

    <group>

        <id>3</id>

        <name>Super Mega Hyper Corp</name>

        <link>http://example.com/context/api/2/groups/3</link>

    </group>

</groups>

Comments


0 Comments

Last Updated: Nov 08,2024