Orders endpoints summary
Here follows a summary of the endpoints and what they are used for.Get orders by contact
Register a new order
Get a specific order
contactId is supplied, a verified check is made that the order is connected to the contact.
Replace an order
Delete an order
Get status of asynchronous request
Trigger action
Update status
Update delivery method
Reacting to a requested change
When you request for an order to be changed or created in the system, you might then want to react to it, for example by sending a confirmation email. There are two ways you can handle this:- Use the job reference ID that is returned in the response to poll Engage and see when the requested change is done (which is when the job status has the value “Completed”).
- include an embedded order action in the payload of your update/create request to instruct Engage what to do when the change is completed. This is similar to sending an order action to the /action endpoint, except you don’t have to poll for “Completed” status.
Must be one of:
- ConfirmOrder
- ConfirmDelivery
- ConfirmShipment
- ConfirmCancellation
- ConfirmCompletion
- Custom
Optional UI language tag.
Custom personalization data, used by the automation trigger.
Steps in the order handling process
Here are the general steps in the order handling process: Only one order with the same orderId will ever be created.- The order request is posted to the /orders endpoint, where the format is validated.
- If the format is valid then “202 Request has been accepted” will be received in the response along with a jobId, a status, the orderId and href, a HTTPS link at the job-status endpoint.
- If the order format you sent was wrong, you’ll get the response “400 Bad Request” along with a list of errors.
- If an order with that orderId already exists, you’ll get “409 Order already exists”.
- Due to asynchronous processing, in a high load scenario multiple requests might create the same order with the same orderId. Here the API might reply “202 Request has been accepted” but the order might already has already been created by another request. The job status endpoint in that case will respond with “409 Order already exists”.
- There is also the case where the order data has the correct format, but the contact given does not exist in Engage. The system will indicate this by returning a status of “CompletedWithErrors”. If this happens, you cannot continue, for example to try and send an action for that order. In this case, you will have to delete the order and create the contact first. Then you can try registering the order again.
- The order is now put into order storage.
- After the order is stored, the job status endpoint will return a 200 OK with Status: Completed.
- Later, the order is connected to a contact and the article and store references are validated.
- If a contact is missing a warning is added to the Integration log.
- If article or store references are incorrect, a warning is logged to the integration log.
- Create the order and ensure you get a “202 Request has been accepted” with a jobId in the response. If you intend to use an embedded order action, make sure to place it in your request payload.
- The next step depends on your integration needs:
- If you have no further processing to do on your side, you are done. The “202 Request has been accepted” response means that Engage has received the order and will process and store it.
- If you need to continue working with the order, poll the status endpoint with the jobId until you get a 200 OK with Status: Completed which means the order has been stored and is ready to use. Or, if you sent an embedded order action in the payload, this will now be automatically triggered.
More about change-status and change-delivery
These asynchronous endpoints are used for updating the status and delivery details of existing orders. These are useful when you need to keep order information in sync with external systems like warehouses, logistics providers, or ERPs, without replacing the entire order.Change order status
The endpoint used to change the order status is:Example payload
Current status of order:
- “InProgress”
- “Completed”
- “Cancelled”
Free-text external status (“Reserved”, “Shipped”).
Timestamp indicating the last change on the order.
Optional. The data that will be sent to the Order Action automation trigger as soon as the requested change is completed.
Response
The expected response is 202 Accepted along with a location header you can poll for the status.Change order delivery
This endpoint allows you to update the delivery method, the tracking information, or the delivery date for an existing order.Example payload
Method of delivery.
Tracking number for the delivery.
Tracking number for the delivery.
Expected delivery date/time.
Timestamp indicating the last change on the order.
The data that will be sent to the Order Action automation trigger as soon as the requested change is completed.