# Work Orders - V3

With these endpoints, you can create, modify, and retrieve work order-related data. For all requests, a shopId is needed to use the correct shop for the request.

# Create Work Orders

Using this endpoint you can create work orders within a specific shop.

# Endpoint

POST /v3/shops/{shopId}/workorders

# Path Parameters

Name Type Description Required
shopId string The id for the used shop ✔️

# Body Parameters

Name Type Description Required
workOrderNumber string A unique number for the work order ✔️
description string A description for the work order
workProvider string The name of the work provider
vehicleInformation string Additional vehicle information
vehicleIdentificationNumber string The VIN for the vehicle
brand string The brand of the vehicle
model string The model of the vehicle
licensePlate string The licenseplate of the vehicle
numberOfFixedPanels double The number of fixed panels
dueDate DateTime The date on which the work order is due (MM/DD/YYYY)
createdBy string The name of the user that created the work order in the BMS ✔️
sourceSystem string The name of the SourceSystem (such as the BMS or DMS software) ✔️
broker string The name of the Broker (Software that implements the integration) ✔️
approvedAmount double The cost that are pre-approved by the customer

# Example successful (201) response:

Status: 201

{
  "id": "43bc3466-b624-42bd-9f31-38d8d51cc237",
  "shopId": "806cf6c9-0123-40b6-bec2-11345128ed36",
  "status": "Open",
  "workOrderNumber": "4300010294033",
  "description": "",
  "workProvider": "CompanyABC",
  "vehicleInformation": "some more information",
  "dueDate": null,
  "closeDate": null,
  "vehicleIdentificationNumber": "123123123",
  "brand": "Tesla",
  "model": "Model 3",
  "licensePlate": "xx-xx-xx",
  "numberOfFixedPanels": 1.0,
  "createdBy": "John Doe",
  "createdOn": "2019-08-19T11:19:23.0655017+02:00",
  "sourceSystem": "sourceSystem",
  "broker": "broker",
  "approvedAmount": "100.25  
}

# Example errors

# Bad Request

The provided shopId is not in expected GUID format

Status: 400

{
  "information": null,
  "error": "Invalid shopId"
}

The BMS Api is not enabled in the shop, so no work order can be created.

Status: 400

{
  "information": null,
  "error": "Not Authorized"
}

The request body was invalid. See response body for detailed information.

Status: 400

{
  "information": [
    {
      "propertyName": "WorkOrderNumber",
      "errorMessage": "'Work Order Number' must not be empty."
    }
  ],
  "error": "Work order is invalid."
}

# Not Found

The shop that was used for creating the work order was not found.

Status: 404

Entity of type Shop was not found.

# Duplicate

An existing work order was found for this work order number.

Status: 409

{
  "information": null,
  "error": "An Entity of type workOrder where Number is equal to 1231231231 already exists for this shop with id c324ca29-6662-4839-9a0d-be32089c23bc and has a unique constraint."
}

The error will contain the information that the work order was created in Mixit when the corresponding SourceSystem of the work order is empty.

Status: 409

{
  "information": null,
  "error": "An Entity of type workOrder where Number is equal to 1231231231 already exists for this shop with id c324ca29-6662-4839-9a0d-be32089c23bc and was created in MIXIT and has a unique constraint."
}

# Internal Server Error

A unknown error occurred during the request.

Status: 500

{
  "information": null,
  "error": "An unknown error occured while performing the requested operation"
}
curl -X POST https://api.akzonobel.com/external/color/mixitbms/v1/v3/shops/{shopId}/workorders \
    -H 'Content-Type: application/json' \
    -H 'Ocp-Apim-Subscription-Key: <apikey>' \
    -d '{
          "workOrderNumber": "4300010294033",
          "description": "Some description",
          "workProvider": "CompanyABC",
          "vehicleInformation": "some more information",
          "vehicleIdentificationNumber": "123123123",
          "brand": "Tesla",
          "model": "Model 3",
          "licensePlate": "xx-xx-xx",
          "numberOfFixedPanels": 1.0,
          "dueDate": "12/15/2019",
          "createdBy": "John Doe",
          "createdOn": "2019-08-21T11:56:12.4493762+02:00",
          "sourceSystem": "CCCOne",
          "broker": "ClaimsCorp",
          "approvedAmount": 100.25
        }'

# Update work order

Using this endpoint you can update an existing work order.

# Endpoint

PUT /v3/shops/{shopId}/workorders/{workOrderId}

# Path Parameters

Name Type Description Required
shopId string The id for the used shop ✔️
workOrderId string The id for the work order to update ✔️

# Body Parameters

Name Type Description Required
status Enum(Open,Closed) The status for the work order ✔️
description string A description for the work order
workProvider string The name of the work provider
vehicleInformation string Additional vehicle information
vehicleIdentificationNumber string The VIN for the vehicle
brand string The brand of the vehicle
model string The model of the vehicle
licensePlate string The licenseplate of the vehicle
dueDate DateTime The date on which the work order is due (MM/DD/YYYY)
numberOfFixedPanels double The number of fixed panels
approvedAmount double The cost that are pre-approved by the customer

# Example successful (204) response:

Status: 204

No Content

# Example errors

# Bad Request

The provided shopId is not in expected GUID format

Status: 400

{
  "information": null,
  "error": "Invalid shopId"
}

The provided work order id is not in expected GUID format

Status: 400

{
  "information": null,
  "error": "Invalid work order id"
}

The BMS Api is not enabled in the shop, so no work order can be created.

Status: 400

{
  "information": null,
  "error": "Not Authorized"
}

The request body was invalid. See response body for detailed information.

Status: 400

{
  "information": [
    {
      "propertyName": "Status",
      "errorMessage": "'Status' must not be empty."
    }
  ],
  "error": "Invalid update request"
}

When a work order has one or more mixes that have the state queued, the work order can not be closed.

Status: 400

{
  "information": null,
  "error": "The work order with the id: c324ca29-6662-4839-9a0d-be32089c23bc can not be closed, because the work order contains 1 or more queued mixes."
}

# Unauthorized

The work order was already closed which means that the work order can't be updated anymore.

Status: 401

{
  "information": null,
  "error": "The work order with the id: b4cf921e-6cbb-4520-acc1-6d0ed0b1a2e2 has already been closed."
}

# Not Found

Either the work order or the shop that was used for creating the work order was not found. See response body for detailed information.

Status: 404

# Internal Server Error

A unknown error occurred during the request.

Status: 500

{
  "information": null,
  "error": "An unknown error occured while performing the requested operation""
}
curl -X PUT https://api.akzonobel.com/external/color/mixitbms/v1/v3/shops/{shopId}/workorders/{workOrderId} \
    -H 'Content-Type: application/json' \
    -H 'Ocp-Apim-Subscription-Key: <apikey>' \
    -d '{
          "status" : "Open",
          "description": "",
          "workProvider": "CompanyABC",
          "vehicleInformation": "some more information",
          "vehicleIdentificationNumber": "",
          "brand": "Tesla",
          "model": "Model 3",
          "licensePlate": "xx-xx-xx",
          "dueDate": "12/15/2019",
          "numberOfFixedPanels": 1.0,
          "approvedAmount": 100.25
        }'

# Get work order

Using this endpoint you can retrieve an existing work order.

# Endpoint

GET /v3/shops/{shopId}/workorders/{workOrderId}

# Path Parameters

Name Type Description Required
shopId string The id for the used shop ✔️
workOrderId string The id for the work order to retrieve ✔️

# Example successful (200) response:

Status: 200

{
  "id": "3fc396e8-9cb0-4eee-86fe-fd99fcd8dbc3",
  "shopId": "806cf6c9-0123-40b6-bec2-11345128ed36",
  "workOrderNumber": "430001029403324",
  "status": "Open",
  "description": "",
  "workProvider": "CompanyABC",
  "vehicleInformation": "some more information",
  "dueDate": null,
  "closeDate": null,
  "vehicleIdentificationNumber": "",
  "brand": "Tesla",
  "model": "Model 3",
  "licensePlate": "xx-xx-xx",
  "numberOfFixedPanels": 1.0,
  "totalPrice": 0.05,
  "totalAmountPoured": 400,
  "unitOfMeasurement": "g",
  "mixReferences": [
    {
      "id": "2dc22be2-7a7f-4538-8e5e-410f13a7d62e",
      "mixingRoom": {
        "id": "33322be2-7a3f-4538-8e5e-433313a3362e",
        "name": "My mixing room"
      },
      "description": "FRD90:UA (Black Ebony)",
      "mixDate": "2019-08-21T09:56:50.828Z",
      "state": "Completed",
      "mixPrice": 0.05,
      "mixPercentage": 100,
      "actualPrice": 0.05,
      "actualPoured": 461.7,
      "unitOfMeasurement": "g",
      "mixedBy" : "John Doe",
      "mixedByUsername" : "support@mixitcloud.com",
      "layers": [
        {
          "isPrimer": false,
          "primerName": null,
          "components": [
            {
              "code": "245",
              "description": "245",
              "pouredAmount": 100,
              "unitOfMeasurement": "g",
              "density": 1.014,
              "isReadyToSprayComponent": false,
              "materialNumber": "123456"
            },
            {
              "code": "00",
              "description": "00",
              "pouredAmount": 100,
              "unitOfMeasurement": "g",
              "density": 6.0,
              "isReadyToSprayComponent": false,
              "materialNumber": "654321"
            },
            {
              "code": "744",
              "description": "744",
              "pouredAmount": 100,
              "unitOfMeasurement": "g",
              "density": 1.003,
              "isReadyToSprayComponent": false,
              "materialNumber": "135246"
            },
            {
              "code": "400",
              "description": "400",
              "pouredAmount": 100,
              "unitOfMeasurement": "g",
              "density": 1.0,
              "isReadyToSprayComponent": false,
              "materialNumber": "642135"
            }
          ]
        }
      ]
    }
  ],
  "createdBy": "John Doe",
  "createdOn": "2019-08-21T11:56:12.4493762+02:00",
  "modifiedOn": "2019-08-21T11:57:02.0974593+02:00"
}

# Example errors

# Bad Request

The provided shopId is not in expected GUID format

Status: 400

{
  "information": null,
  "error": "Invalid shopId"
}

The provided work order id is not in expected GUID format

Status: 400

{
  "information": null,
  "error": "Invalid work order id"
}

The BMS Api is not enabled in the shop, so no work order can be created.

Status: 400

{
  "information": null,
  "error": "Not Authorized"
}

# Not Found

Either the work order or the shop that was used for creating the work order was not found. See response body for detailed information.

Status: 404

# Internal Server Error

A unknown error occurred during the request.

Status: 500

{
  "information": null,
  "error": "An unknown error occured while performing the requested operation""
}
curl -X GET https://api.akzonobel.com/external/color/mixitbms/v1/v3/shops/{shopId}/workorders/{workOrderId} \
    -H 'Ocp-Apim-Subscription-Key: <apikey>'

# Get all work orders

Using this endpoint you can retrieve all work orders of a state between 2 dates.

# Endpoint

GET /v3/shops/{shopId}/workorders?state={state}&dateFrom={dateFrom}&dateTill={dateTill}

# Path Parameters

Name Type Description Required
shopId string The id for the used shop ✔️

# Query Parameters

Name Type Description Required
State Enum(Open,Closed) The status for the work order ✔️
DateFrom* DateTime The date from the day you want to retrieve the work orders (MM/DD/YYYY) ✔️
DateTill* DateTime The date till the day you want to retrieve the work orders (MM/DD/YYYY) ✔️

*The range should not exceed the cap of 30 days.

# Example successful (200) response:

Status: 200

[
    {
        "id": "70e08e79-7127-46f4-9e7f-ae26bebd349a",
        "shopId": "7c5a1cad-7008-446e-8353-6102c53c240e",
        "workOrderNumber": "4300010294033337"
    },
    {
        "id": "ac73e2bb-86ab-4656-b803-27d21c05277f",
        "shopId": "7c5a1cad-7008-446e-8353-6102c53c240e",
        "workOrderNumber": "4300010294033338"
    }
]

# Example errors

# Bad Request

The provided shopId is not in expected GUID format

Status: 400

{
  "information": null,
  "error": "Invalid shopId"
}

The BMS Api is not enabled in the shop, so no work order can be created.

Status: 400

{
  "information": null,
  "error": "Not Authorized"
}

The BMS Api is not enabled in the shop, so the work orders can not be retrieved.

Status: 400

{
  "information": null,
  "error": "Not Authorized"
}

The date could be in the wrong format. Please use MM/DD/YYYY. Or the date range exceed the maximum of 30 days.

Status: 400

{
    "information": "Dates should be formatted 'MM/DD/YYYY' and the range should not be larger then 30 days.",
    "error": "Invalid date-range"
}

# Internal Server Error

A unknown error occurred during the request.

Status: 500

{
  "information": null,
  "error": "An unknown error occured while performing the requested operation""
}
curl -X GET https://api.akzonobel.com/external/color/mixitbms/v1/v3/shops/{shopId}/workorders?state={state}&dateFrom={dateFrom}&dateTill={dateTill} \
    -H 'Ocp-Apim-Subscription-Key: <apikey>'

# Delete work order

Using this endpoint you can delete an existing work order.

# Endpoint

DELETE /v3/shops/{shopId}/workorders/{workOrderId}

# Path Parameters

Name Type Description Required
shopId string The id for the used shop ✔️
workOrderId string The id for the work order to delete ✔️

# Example successful (200) response:

Status: 200

{
  "id": "3fc396e8-9cb0-4eee-86fe-fd99fcd8dbc3",
  "shopId": "806cf6c9-0123-40b6-bec2-11345128ed36",
  "workOrderNumber": "430001029403324",
  "status": "Open",
  "description": "",
  "workProvider": "CompanyABC",
  "vehicleInformation": "some more information",
  "dueDate": null,
  "closeDate": null,
  "vehicleIdentificationNumber": "",
  "brand": "Tesla",
  "model": "Model 3",
  "licensePlate": "xx-xx-xx",
  "numberOfFixedPanels": 0,
  "totalPrice": 0.05,
  "totalAmountPoured": 500,
  "unitOfMeasurement": "g",
  "mixReferences": [],
  "createdBy": "John Doe",
  "createdOn": "2019-08-21T11:56:12.4493762+02:00",
  "modifiedOn": "2019-08-21T11:57:02.0974593+02:00",
  "approvedAmount": 100.25
}

# Example errors

# Bad Request

Either the provided work order id or shop id doesn't match our format.

Status: 400

{
  "information": "Invalid parameter: The parameter with name shopId is invalid",
  "error": "The parameter with name shopId is invalid"
}

The BMS Api is not enabled in the shop, so the work order can not be deleted. See the error value if the response body for detailed information.

Status: 400

{
  "information": null,
  "error": "Not Authorized"
}

# Unauthorized

The work order is already closed.

Status: 401

{
  "information": null,
  "error": "The work order with the id: 3fc396e8-9cb0-4eee-86fe-fd99fcd8dbc3 has already been closed."
}

# Not Found

Either the work order or the shop that was used for creating the work order was not found. See response body for detailed information.

Status: 404

# Internal Server Error

A unknown error occurred during the request.

Status: 500

{
  "information": null,
  "error": "An unknown error occured while performing the requested operation""
}
curl -X DELETE https://api.akzonobel.com/external/color/mixitbms/v1/v3/shops/{shopId}/workorders/{workOrderId} \
    -H 'Ocp-Apim-Subscription-Key: <apikey>'