# Apply changes to statuses of jobs

Updates the status of one of more jobs, so that these changes can be reflected upon the tour instantly. This is only an auxiliary way for providing Bettermile with job updates, while the main job updates are still to be transmitted over the connector.

Endpoint: POST /v1/tours/{tourId}/jobs/statuses
Version: 1.0.0
Security: ApiKeyAuth

## Security:

  - `ApiKeyAuth` (unknown)
    apiKey in header x-api-key

## Path parameters:

  - `tourId` (string, required)
    Unique tour identifier (generated by Better Route backend)

## Request fields (application/json):

  - `statusChanges` (array)
    List of job status changes to be applied (only 1 status change per job is allowed)

  - `statusChanges.jobId` (string, required)
    Job identifier generated by the backend

  - `statusChanges.state` (string, required)
    Status of the job:
- PROCESSED: The job has been processed (e.g. delivered, picked up or collected)
- UNPROCESSED: The job has not been processed yet
- UNKNOWN: The processing status of the job could not be determined
    Enum: "PROCESSED", "UNPROCESSED", "UNKNOWN"

  - `statusChanges.timestamp` (string, required)
    Time at which this job status was changed (it should not be older than 1h)

  - `statusChanges.outcome` (any)
    Example: SUCCESS

  - `statusChanges.description` (string)
    Description for the status change

  - `statusChanges.coords` (any)

  - `statusChanges.coords.lat` (number)
    Latitude

  - `statusChanges.coords.lon` (number)
    Longitude

## Response 200:

  - `200` (unknown)
    Changes to statuses of jobs have been successfully applied

## Response 200 fields (application/json):

  - `data` (object)
    Example: {}

## Response 400:

  - `400` (unknown)
    Error response returned when the request is invalid. In most cases this implies that some data in the request is either missing or has incorrect format.

## Response 400 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 401:

  - `401` (unknown)
    Error response returned when the provided API key is missing or invalid

## Response 401 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 404:

  - `404` (unknown)
    Error response returned in cases the requested endpoint or data can't be found

## Response 404 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 429:

  - `429` (unknown)
    Error response returned in case operation encounter rate limit

## Response 429 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 500:

  - `500` (unknown)
    Error response returned whenever the server fails to process the request

## Response 500 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

