This method returns a list of trainings within your organization.

Note: this endpoint is titled "v2" because the previous endpoint trainings.list is deprecated and will be removed October 1, 2020. The new response format is very similar but with the following changes:

  • database keys (such as `id`) are now integers instead of strings
  • properties such as `renewalMonths` have been converted from camel casing to underscores: `renewal_months`


Parameters

Your request data may contain the following parameters. GET or POST the object (as JSON) to https://api.kpaehs.com/v1/trainings.v2.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": [
    {
      "id": 1024,
      "title": "Coordinator Training",
      "created": 1582829328965,
      "lesson_id": 1044,
      "included_trainings_id": [
        1025,
        1026
      ],
      "schedule_type": "rolling",
      "renewal_months": 12,
      "certificate_text": "This text goes on PDF certificates.",
      "assigned_to_type": "limited",
      "assigned_to_condition": {
        "data": {
          "fieldId": "job-title",
          "settings": {
            "values": [
              "5e580f0db780600088bd2c2d"
            ]
          }
        }
      },
      "is_highlighted": false,
      "notes": "These are internal notes about Coordinator Training.",
      "expires_on_month": null,
      "expires_on_day": null,
      "expiring_days": 14,
      "window_open_month": null,
      "window_open_day": null,
      "window_close_month": null,
      "window_close_day": null,
      "window_last_offered_date_number": null,
      "window_required_for_new_employees": false
    },
    {
      "id": 1035,
      "title": "Zone Manager Training",
      "created": 1582829328966,
      "lesson_id": null,
      "included_trainings_id": [],
      "schedule_type": "rolling",
      "renewal_months": 6,
      "certificate_text": "",
      "assigned_to_type": "all",
      "assigned_to_condition": {},
      "is_highlighted": true,
      "notes": "",
      "expires_on_month": 12,
      "expires_on_day": 31,
      "expiring_days": 7,
      "window_open_month": null,
      "window_open_day": null,
      "window_close_month": null,
      "window_close_day": null,
      "window_last_offered_date_number": null,
      "window_required_for_new_employees": false
    },
    {
      "id": 1025,
      "title": "Chemical Awareness",
      "created": 1582829328964,
      "lesson_id": 1643,
      "included_trainings_id": [],
      "schedule_type": "window",
      "renewal_months": null,
      "certificate_text": "",
      "assigned_to_type": "none",
      "assigned_to_condition": {},
      "is_highlighted": true,
      "notes": "",
      "expires_on_month": null,
      "expires_on_day": null,
      "expiring_days": 14,
      "window_open_month": 6,
      "window_open_day": 1,
      "window_close_month": 6,
      "window_close_day": 30,
      "window_last_offered_date_number": 20190616,
      "window_required_for_new_employees": true
    }
  ]
}

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.