The inventory rollback allocation API is used in certain specific e-commerce application failure modes. In some cases, the application encounters a problem in order submission such that:

  1. Inventory has been reserved for the order via an Inventory Allocation API call.

  2. The order cannot be submitted to ROM.

In these cases, reserved inventory must be explicitly canceled. The inventory rollback allocation API is used to cancel inventory reservations.

Building an Inventory Rollback Allocation API Request

The inventory rollback allocation API requires the following data to be supplied as part of the request message.

  • The reservation identifier, which was used for the inventory allocation API request

  • A globally unique request identifier, which is used by ROM to make the request idempotent

The figure below illustrates an inventory rollback allocation API request message.

Example inventory rollback allocation request with one line.

<?xml version="1.0" encoding="UTF-8"?>
<RollbackAllocationRequestMessage
        xmlns="http://api.gsicommerce.com/schema/checkout/1.0"
        requestId="e0b70db2-58c3-4e5b-bd77-7c14a6ef8945"    <!-- see NOTE1 -->   
        reservationId="9c6fc61f-3783-48a6-b5e9-8b231d1a0615"/> <!-- see NOTE2 -->
NOTE1 Globally unique request identifier
NOTE2 Identifier of the inventory reservation being canceled

Interpreting the Inventory Allocation API Response

To invoke inventory rollback allocation API request, send a request message like that above to /v1.0/stores/<your store ID>/inventory/allocations/delete.xml via HTTPS POST with the following HTTP headers.

ApiKey: <your API key>ContentType: text/xml

The ROM inventory rollback allocations API supports the following HTTP response status codes:

Status Description Action

200

Success

Interrogate the response payload for additional information.

400

Bad request. The API could not process the request due to either a syntax error or bad data in the provided request payload.

This is a programming time error. Interrogate the fault message in the response payload for more information. Fix the syntax or data issue in the requesting application.

500

API processing error. The API could not process the request due to a temporary internal error.

Ignore and proceed with any further error processing.

Timeouts
e-commerce application should set a reasonable timeout on all ROM API calls. If an API call does not respond within the configured timeout the application should proceed as if the call returned a 500 http status.

The figure below is an example of a successful inventory rollback allocation call.

Copy this code sample.
<?xml version="1.0" encoding="UTF-8"?>
<RollbackAllocationResponseMessage
        xmlns="http://api.gsicommerce.com/schema/checkout/1.0"
        reservationId="9c6fc61f-3783-48a6-b5e9-8b231d1a0615"/> <!-- see NOTE1 --> 
NOTE1 Identifier of the canceled reservation