Open API – Delete order lines

1. API overview

Endpoint POST /v1/orders/confirm-order-lines
Description Confirm the list of order lines that need to be retained. This means that any order lines of the order not included in the request body will be deleted automatically (if possible) when the request is sent.
Usage Call this API to delete order lines are not included in the request body.
Return Return type: boolean.

2. Prerequisite

  • Order lines included orderImportId
  • Order lines included orderLineImportId

3. Request parameters and body

The corresponding request body type can be found at the Swagger page, model OrderLineConfirmation.

Field Data type Required Description & Constraints
orderImportId String Yes orderImportId of the order
orderLineImportIds String Yes Confirm the orderLineImportId list to specify which order lines should be retained.

4. Response

Status code Response body Description
200 A boolean. The order line list in the request is confirmed. The rest in the order but not having in the request will be deleted accordingly.
400 The system’s standard error response object. See an examples of error responses in section API requests and responses.

5. Example

We will use Swagger UI to create an order.

First, obtain a security token and authorize the Swagger requests. See Authentication for more information.

Next, in this example, we have an order with information as below:

  • Order:
    • “orderImportId”: “SO161224”
  • Order line:
    • “orderLineImportId”: “Line 1”
    • “orderLineImportId”: “Line 2”
    • “orderLineImportId”: “Line 3”

Then, make a request to the endpoint, the request body looks like:

{
  "orderImportId": "SO161224",
  "orderLineImportIds": [
    "Line 1", "Line 2"
  ]
}

The system responses with status code of 200, the response body is the boolean value: true.

In Onix Work, the result will be shown as below:

This result suggests that after sending the request, only the order lines with orderLineImportId as “Line 1” and “Line 2” are retained, while “Line 3” is deleted.

Note: If an order line has already been processed, it will be retained regardless of whether it is included in the request body. This behavior ensures that all processed order lines continue to follow the current logic.

6. Integrating suggestions

Based on the prerequisites and API design, we recommend using this endpoint whenever there are changes to order or order line information. This ensures that any order lines deleted in the ERP system are also deleted in the Onix Work system.