# Update Order Status

### Update workflow status (Third party->Spectrum)

Once an order has been submitted to Spectrum, the third-party can send Spectrum the workflow status for each order. This is done over HTTP as a REST API call.

```http
PUT https://{SpectrumEnvironment}/api/order/status HTTP/1.1
SPECTRUM_API_TOKEN: {SpectrumApiToken}
Content-Type: application/json
```

The available `{SpectrumEnvironment}` base URLs are listed in the [Environments](https://docs.spectrumcustomizer.com/integration/api/environments) page.

#### **LineItem Format - Required**

* `purchaseOrderNumber` (string)
* `lineItems` (array)
* `lineItems[n]` (object)
  * `recipeSetReadableId` (string)
  * `workflowStatus` (string)

**Workflow Statuses**

* not-started
* in-progress
* completed
* revision
* on-hold
* approved
* delivered
* cancelled

#### **LineItem Format:** Example request body

```javascript
{
  "purchaseOrderNumber": "HA-US-DEV00011101",
  "lineItems": [{
      "recipeSetReadableId": "ABCD1234",
      "workflowStatus": "in-progress"
    }
  ]
}
```

### Status Codes + **UpdateWorkflowStatus** response payload

&#x20;**200 (Accepted)** : indicates that the request has been accepted and all line-items have been updated.&#x20;

```json
{
    "purchaseOrderNumber": "HA-US-DEV00011101",
    "status": "OK",
    "details": "Updated workflow status for recipeSetReadableId(s): MUEMVK2U."
}
```

**409 (Conflict)**: indicates that the REST API can’t find one or more of the line-items.&#x20;

```json
{
    "purchaseOrderNumber": "HA-US-DEV00011102",
    "status": "Error",
    "details": "Unable to find recipeSetReadableId(s): MUEMVK2U."
}
```

For a multiple line-item order, if any of the line-items are missing within Spectrum, no line-items in the order are updated.&#x20;

**500 (Internal Server Error)**: indicates the error encountered with the request or an internal operation.

```json
{
    "purchaseOrderNumber": "HA-US-DEV00011103", 
    "status": "Error",
    "details": "Update status for HA-US-DEV00011103 encountered an error."
}
```
