DELETE v3/orders/:id
DELETE/v3/orders/:id
Cancel an order, or as much of it as has not shipped yet.
Invoking this endpoint will cause the server to make an effort to cancel an order by cancelling each of its orderItems. This may succeed when there is no shipment fulfilling any of the orderItems yet. Otherwise the cancellation will be at best partially successfull.
Depending on the result the server response will be slightly different. (See below and the examples)
Including related resources
The endpoint also supports -to some degree- the inclusion of information of related resources. The resources that can be included in the response are limited to the orderItems, the deliveryAddress, the billingAddress and the pickUpPoint. To get the details of related entities the include parameter must be added to the URI in the following way:
DELETE {host}/v3/orders?include=orderItemswill attempt to cancel the order and return theorderand all itsorderItemsin their new state.
Responses
Partial or Complete Cancellation
If the order was partially or completely cancelled (for example, if it was already partially fulfilled), the server will respond with a field meta.modified attribute set to true. This indicates that the order was modified. To determine which orderItems were modified as a result of this request, the server response will include an array of ids of orderItems in the element meta.modifiedItems. To determine the completeness of the cancellation, refer to the quantities on the orderItems.
No Change
If none of the orderItems of the order could be cancelled because they were already completely fulfilled, the server will still respond with a 200: OK. However, the attribute meta.modified will be set to false, indicating that the order was not modified as a result of this request.
Limitations of the DELETE v3/orders/:id
- Users are rate-limited to 500 requests per hour on this service.
Request
Responses
- 200
- 401
- 403
- 404
- 406
- 415
- 429
The 200: OK response includes information about the result of
the cancellation request. As indicated the order might be cancelled in its
entirety, partially or not at all. To understand if anything changed as a
result of the request, the field meta.modified will be set to true.
Additionally an array of modified orderItems is returned in the
meta.modifiedItems element in the response.
401 Unauthorized
A 401 Unauthorized response occurs when attempting to access a resource or perform an action that requires authentication, but no valid credentials have been provided. It indicates that the requester is unauthorized to access the requested resource.
The following are common scenarios that may lead to a 401 Unauthorized response:
- Attempting to access a protected API endpoint without providing authentication credentials.
- Providing an invalid or expired authentication token.
- Providing valid authentication credentials, but lacking sufficient privileges to access the requested resource.
- Providing authentication credentials that are valid for a different resource or API endpoint than the one being requested.
403 Forbidden
The HTTP 403 Forbidden client error response status code indicates that the server understood the request but refused to process it. This status is similar to 401 Unauthorized, except that for 403 Forbidden responses, authenticating or re-authenticating makes no difference. The request failure is tied to application logic, such as insufficient permissions to a resource or action.
404 Not Found
A 404 Not Found response occurs when attempting to access a resource that cannot be found on the server. It indicates that the requested resource does not exist, either because it has been deleted, the URL is incorrect or because the endpoint has not been realized.
The following are common scenarios that may lead to a 404 Not Found response:
- Attempting to access an endpoint with an invalid or non-existent URL.
- Attempting to access an endpoint that has not (yet) been realized
- Requesting a resource that has been deleted or moved.
406 Not Acceptable
A 406 Not Acceptable response occurs when the server cannot provide a response that matches the client's requested format or content language for the requested resource. For instance, if a client sends an Accept header of text/html to an API endpoint that only supports application/json responses, the server would respond with a 406 Not Acceptable status code. This type of response is a required response for JSON:API compatible endpoints.
415 Unsupported Media Type
A 415 Unsupported Media Type response occurs when the server cannot process the request because the media type specified in the request is not supported for the requested resource. For example, if a client sends a request with a Content-Type header of application/pdf to an API endpoint that only supports application/json (the only valid media type for JSON:API), the server would respond with a 415 Unsupported Media Type status code. This type of error-response is a required for JSON:API compatible endpoints.
429 Too Many Requests
The request could not be completed because of a rate limit violation.