Retrieve metrics for a path session: Migration guide

This guide details how the functionality of retrieving path session stats has changed. In v1, breakdown of users per status (completed, enrolled, etc) were embedded within the getPathSessionStats endpoint. In v2, this information is now accessed through the Retrieve metrics for a path session endpoint.

💡

Key changes

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/paths/sessions/:sessionId/stats
  • API v2: /api/v2/paths/{pathId}/sessions/{sessionId}/user-statuses

Behavior changes

The key behavior change is the separation of concerns. Instead of getting user's breakdown per status and path session individual stats in one go, you now make a specific call to retrieve the users' breakdown per status. This allows for more efficient retrieval of information given your use-case.

Input changes

This section details the specific alterations to the input requirements between API versions.

API v1 input example

curl --location -g 'https://{{host}}/api/v1/paths/sessions/5bead809990d8862f3c514aa/users?company={{company}}&apiKey={{apiKey}}'

API v2 input example

curl --request GET \
     --url https://app.360learning.com/api/v2/paths/507f1f77bcf86cd799439011/sessions/507f1f77bcf86cd799439011/user-statuses \
     --header '360-api-version: v2.0' \
     --header 'accept: application/json'

Main input differences

Change typeAPI v1API v2
Added
Path parameter
-pathId (Required): path unique ID.

Output changes

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

API v1 output example

{
  "sessionId": "65859a418d8f19cd4063457a",
  "sessionName": "January Session",
  "pathName": "Digital skills",
  "pathId": "6585958a3c2446e9b399f341",
  "usersStatus": {
    "completed": 0,
    "enrolled": 5,
    "inProgress": 5,
    "selfEnrolled": 0,
    "started": 5,
    "successful": 0
  },
  "certificates": 0,
  "detailedStatus": {
    "awaitingCorrection": 0,
    "late": 0,
    "notYetStarted": 0,
    "onTime": 0,
    "sessionNotOpened": 0,
    "successful": 0,
    "toRetake": 0,
    "unsuccessful": 5
  },
  "usersStats": [
    {
      "_id": "647092a741a809ed36889ecf",
      "deleted": false,
      "firstName": "Ada",
      "lastName": "Lovelace",
      "mail": "[email protected]",
      "progress": 20,
      "totalTimeSpentInSeconds": 4.084,
      "score": null,
      "status": "late",
      "completedAt": null,
      "detailedStatus": {
        "type": "unsuccessful",
        "reason": "sessionEnded"
      },
      "certificate": false,
      "customFields": []
    },
    {
      "_id": "647318a731a809ed36889ed0",
      "deleted": false,
      "firstName": "Grace",
      "lastName": "Hopper",
      "mail": "[email protected]",
      "progress": 20,
      "totalTimeSpentInSeconds": 12.45,
      "score": 0,
      "status": "late",
      "completedAt": null,
      "detailedStatus": {
        "type": "unsuccessful",
        "reason": "sessionEnded"
      },
      "result": "retake",
      "certificate": false,
      "customFields": []
    },
    {
      "_id": "647a98a731a809ed36d8fed1",
      "deleted": false,
      "firstName": "Jane",
      "lastName": "Austen",
      "mail": "[email protected]",
      "progress": 80,
      "totalTimeSpentInSeconds": 11.678,
      "score": 100,
      "status": "onTime",
      "completedAt": null,
      "detailedStatus": {
        "type": "unsuccessful",
        "reason": "sessionEnded"
      },
      "certificate": false,
      "customFields": []
    },
    {
      "_id": "647098a731a809ed36889ed2",
      "deleted": false,
      "firstName": "Maya",
      "lastName": "Angelou",
      "mail": "[email protected]",
      "progress": 40,
      "totalTimeSpentInSeconds": 6.71,
      "score": 0,
      "status": "late",
      "completedAt": null,
      "detailedStatus": {
        "type": "unsuccessful",
        "reason": "sessionEnded"
      },
      "result": "retake",
      "certificate": false,
      "customFields": []
    },
    {
      "_id": "647098a731a809ed3sfd9ed7",
      "deleted": false,
      "firstName": "Virginia",
      "lastName": "Woolf",
      "mail": "[email protected]",
      "progress": 20,
      "totalTimeSpentInSeconds": 12.62,
      "score": 0,
      "status": "late",
      "completedAt": null,
      "detailedStatus": {
        "type": "unsuccessful",
        "reason": "sessionEnded"
      },
      "certificate": false,
      "customFields": []
    }
  ]
}

API v2 output example

{
  "certificates": 0,
  "usersCountByStatus": {
    "awaitingCorrection": 0,
    "late": 0,
    "notYetStarted": 0,
    "onTime": 0,
    "sessionNotOpened": 0,
    "successful": 0,
    "toRetake": 0,
    "unsuccessful": 0
  }
}

Main output differences

Change typeAPI v1API v2
Removed
Output property
sessionId: Removed from this v2 version.-
Removed
Output property
sessionName: Removed from this v2 version.-
Removed
Output property
pathId: Removed from this v2 version.-
Removed
Output property
pathName: Removed from this v2 version.-
Removed
Output property
usersStats: Removed from this v2 version.Individual path session stats can be retrieved using List all user statistics.