Update a training path

This endpoint allows updating the full definition of a training path in the catalog: its data, its courses and the schedule of its trainings.

PUT /api/v2/businesses/{businessId}/training-paths/{trainingPathId}

Below is a detailed explanation of each of the fields that can make up the request body, with some being mandatory for the request to be successful.

Mandatory fields are marked with an asterisk (*).

Request body

JSON Analysis
{
  "id": "string",
  "name": "string",
  "description": "string",
  "abbreviation": "string",
  "color": "string",
  "courseIds": [
    "string"
  ],
  "trainingsOrder": [
    {
      "trainingId": "string",
      "day": 0,
      "order": 0
    }
  ]
}
Details
  • id: external identifier of the training path. If it is not provided when creating the training path, Orquest generates one automatically.

  • name*: name of the training path. Maximum 50 characters.

  • description: description of the training path. Maximum 500 characters.

  • abbreviation*: abbreviation of the training path. Maximum 5 characters.

  • color*: color used to represent the training path, in hexadecimal format (for example, #1F7A5A).

  • courseIds*: list of external identifiers of the courses that make up the training path, in the order in which they must be taken. It must contain at least one course and cannot repeat courses.

  • trainingsOrder: schedule of all the trainings of the training path. If it is not provided, Orquest calculates it automatically. For each training, the following information is included:

    • trainingId*: external identifier of the training. It must belong to one of the courses of the training path.

    • day*: day of the training path on which the training takes place. It is a relative value starting at 1, the start day of the training path.

    • order*: order of the training within its day.

Request example

Once the analysis of the different fields has been done, an example of the request is shown:

PUT /api/v2/businesses/BUSINESSID/training-paths/TP-RES
{
    "id": "TP-RES",
    "name": "Shift manager",
    "abbreviation": "RES",
    "color": "#C3AAFC",
    "description": "Full path: store, sales, cash register and closing",
    "courseIds": [
        "CRS-VAC",
        "CRS-BTI",
        "CRS-CAJ",
        "CRS-CIE"
    ]
}

If the request is correct, the response will be a 200 OK with the resulting training path.

Considerations

The request replaces the whole definition of the training path. The id in the body is ignored and the training path keeps the identifier given in the URL.

If trainingsOrder is not provided, Orquest recalculates the schedule automatically and any previously defined schedule is lost.

The trainingsOrder field must meet the same conditions as when creating the training path.

Changes to the training path do not affect the course assignments already created from it.

Error codes

In addition to the common errors, this endpoint can return the following codes:

Code Message Description

404 Not Found

Training path not found: <trainingPathId>

The given trainingPathId does not exist in the business.

Course not found: <courseId>

One of the courses in courseIds does not exist in the business.

Training not found in the training path courses: <training>

One of the trainings in trainingsOrder does not belong to the courses of the training path.

400 Bad Request

At least one course is required

The courseIds field was not provided or is empty.

One or more courses not found

The courseIds field contains repeated courses.

Name cannot be longer than 50 characters

The name field exceeds 50 characters.

Description cannot be longer than 500 characters

The description field exceeds 500 characters.

Abbreviation cannot be longer than 5 characters

The abbreviation field exceeds 5 characters.

-

The color field is not a valid hexadecimal color.

Training path order contains duplicate training ids

The trainingsOrder field contains repeated trainings.

Training path order must contain exactly all trainings from all courses, no more and no less

The trainingsOrder field does not include all the trainings of the courses of the training path, or it was sent empty.

Training path order does not respect the internal order of course

The schedule in trainingsOrder changes the order of the trainings of one of the courses.

What is a training path?

What is a course?