This method returns a list of trainings within your organization.


Parameters

Your request data may contain the following parameters. GET or POST the object (as JSON) to https://api.kpaehs.com/v1/trainings.list.

Parameter TypeScript Example Required Description
token string "YOUR_TOKEN" Required Your API Token
pretty boolean true Optional true means the response json will include white space for readability. Default is false.

Example Request


Example Response

{
  "ok": true,
  "trainings": [
    {
      "title": "Driver Training",
      "created": 1476718839584,
      "includedTrainings_id": [],
      "renewalMonths": 12,
      "assignedToType": "limited",
      "assignedToCondition": {
        "data": {
          "fieldId": "driver",
          "settings": {
            "values": [
              "true"
            ]
          }
        }
      },
      "isHighlightedOnEmployeeProfile": false,
      "id": "5804f0f70ef50473af5871a8"
    },
    {
      "title": "Ladder Safety",
      "created": 1476718839585,
      "lesson_id": 1026,
      "includedTrainings_id": [],
      "renewalMonths": 12,
      "assignedToType": "all",
      "assignedToCondition": {},
      "Notes": "Be sure to contact Susan for schedule changes with this training.",
      "isHighlightedOnEmployeeProfile": false,
      "id": "5804f0f70ef50473af5871a9"
    },
    {
      "title": "First Aid Training",
      "created": 1476718839586,
      "lesson_id": 1024,
      "includedTrainings_id": [],
      "renewalMonths": 12,
      "assignedToType": "all",
      "assignedToCondition": {},
      "isHighlightedOnEmployeeProfile": false,
      "id": "5804f0f70ef50473af5871aa"
    },
    {
      "title": "Acme Training",
      "created": 1476718839586,
      "lesson_id": 1025,
      "includedTrainings_id": [
        "5804f0f70ef50473af5871c1",
        "5804f0f70ef50473af5871c2",
        "5804f0f70ef50473af5871c3"
      ],
      "renewalMonths": 0,
      "assignedToType": "all",
      "assignedToCondition": {},
      "isHighlightedOnEmployeeProfile": true,
      "id": "5804f0f70ef50473af5871ab"
    },
    {
      "_id": "5d0bb70139e474b615363590",
      "title": "On-Site H2S Training",
      "created": 1476718839586,
      "lesson_id": 1088,
      "scheduleType": "window",
      "window_lastOfferedDateNumber": 20180701,
      "window_closeDay": 1,
      "window_closeMonth": 8,
      "window_openDay": 1,
      "window_openMonth": 7,
      "window_requiredForNewEmployees": true,
      "window_tasksOutsideOfWindow": true,
      "requiredFor": {
        "criteria": null,
        "everyone": false
      },
      "assignedToType": "none",
      "inAppAttachments": false,
      "isHighlightedOnEmployeeProfile": false,
      "includedTrainings_id": []
    }
  ]
}

Errors

If an error occurs, the response JSON will have ok set to false:

{
  "ok": false,
  "error": "token_invalid",
  "description": "The token `YOUR_TOKEN` was not found."
}

The error field will contain one of the following error identifiers and there may also be a description field with a more detailed explanation:

Identifier Description
api_method_not_found The requested url did not match any KPA Flex API method.
request_method_invalid The requested method was not GET or POST.
request_data_invalid The request did not include a valid JSON request object.
rate_limit_exceeded This token is exceeding its request limit.
token_missing The request did not include a token.
token_invalid The request token was invalid.
token_inactive The request token was has been deactivated.
token_permission The request token does not have write permission.
account_inactive The request token was for an account that is not active.
parameter_unexpected The request data included a parameter that is not supported.
parameter_missing The request data failed to include a parameter which was required.
parameter_invalid The request data included a parameter which had a value that is not allowed.
server_error The server encountered an internal error.
content_not_found The requested content was not found.