List all groups: Migration guide

This guide outlines the changes introduced in the List all groups v2 endpoint (previously known as getGroups in v1).

💡

Key changes

Pagination: The v2 endpoint is paginated and returns 500 groups per page.

Documentation links

Here are the links to the API reference for:

Endpoint mapping

Here's the direct correlation between the v1 and v2 endpoint URLs:

  • API v1: /api/v1/groups
  • API v2: /api/v2/groups

Input changes

There are no endpoint-specific input changes for this request. All input changes relate to the new authentication and versioning headers, which are detailed in the Authentication guide.

API v1 input example

curl --location 'http://app.360learning.com/api/v1/groups?company={{company}}&apiKey={{apiKey}}'

API v2 input example

curl --request GET \
     --url https://app.360learning.com/api/v2/groups \
     --header '360-api-version: v2.0' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer access_token'

Output changes

This section details the specific alterations to the output returned between API versions.

API v1 output example

[
  {
    "_id": "58eb5f371a92bb4fb526b305",
    "name": "A private group",
    "parent": "58eb5d671a92bb4fb526b2cb",
    "public": false,
    "custom": "Unit 101"
  }
]

API v2 output example

[
  {
    "public": false,
    "parentId": "507f1f77bcf86cd799439011",
    "_id": "58eb5f371a92bb4fb526b305",
    "name": "A private group",
    "custom": "Unit 101"
  }
]

Main output differences

API v2 introduces pagination for the List all groups endpoint. Instead of returning all groups in a single response, it now returns a maximum of 500 groups per page. To retrieve subsequent pages, you need to follow the URL provided in the Link header of the response.

Additionally, the parent field in v1 is now parentId in v2.

Change typeAPI v1API v2
Modified
Output property
parent: The unique ID of the parent group.parentId: The unique ID of the parent group.
Modified
Success response
200: Returns an array of all groups.200: Returns one page of 500 groups.
Added
Header
-Link: String. URL (between < and >) to fetch the immediate next page of results. Only included if there is another page of results.
Added
Error code
-403: Invalid scope.