# Assign a module to a user

Assigns the training module in the URL to one user and returns the new
assignment in the same shape as reading it, so a follow-up read is not
needed.
A user can hold only one live assignment per module. Asking for one that
already exists returns a **403**, not a conflict or a duplicate - so check
for an existing assignment first if you cannot be sure. Deleting an
assignment frees the user to be assigned again.
An unknown user, or a request with no user_id at all, returns a **404**.
Only user_id and status are read. Every other writable field is ignored here,
so a new assignment always starts with no score, no external reference and no
steps completed; set those with a follow-up update. status is checked against
the five permitted values and a 422 names it if it is not one of them.

Endpoint: POST /api/v2/training/{training_id}/user
Version: 2.0.0
Security: default

## Path parameters:

  - `training_id` (integer, required)
    The ID of the training module.

## Header parameters:

  - `Rosterfy-Platform` (string)

## Request fields (application/json):

  - `user_id` (integer, required)
    The user the module is assigned to. Required on create. Sending it on update hands the assignment, and the progress recorded against it, to a different user - so omit it unless that is what you want.

  - `status` (string)
    Where the user has got to. One of COMPLETE, INCOMPLETE, PASSED, FAILED or EXEMPT. Defaults to INCOMPLETE on create. Setting it to COMPLETE also sets steps_completed to the module's full step count; setting it back to INCOMPLETE from COMPLETE resets steps_completed to 0.

## Response 201 fields (application/json):

  - `object` (object)

  - `object.id` (integer)

  - `object.training_id` (integer)

  - `object.user_id` (integer)

  - `object.steps_completed` (integer)

  - `object.status` (string)

  - `object.score` (integer)

  - `object.expires_at` (string | null)

  - `object.meta` (string | null)

  - `object.external_id` (string | null)

  - `object.deleted_at` (string | null)

  - `object.created_at` (string)

  - `object.updated_at` (string)

  - `nice` (object)

  - `nice.rrn` (string)

  - `nice.training_name` (string)

  - `nice.training_service` (string)

  - `nice.training_meta` (object)

  - `nice.training_meta.middleware` (string)

  - `nice.has_history` (boolean)

  - `nice.training_success_message` (string)

  - `nice.is_expired` (boolean)

  - `nice.status` (string)

  - `nice.binary_status` (boolean)

  - `nice.finished_status` (boolean)

  - `nice.score_percentage` (integer)

  - `nice.steps_percentage` (number)

  - `relations` (object)

  - `permissions` (object)

  - `permissions.read` (boolean)

  - `permissions.update` (boolean)

  - `permissions.delete` (boolean)

## Response 403 fields (application/json):

  - `message` (string)

