Aurora API: Stock

While 'stock' is strictly speaking a feature of 'Products' it is detailed independently due to some unique services provided to better support the unique nature in which this data is handled.

Get

Deferred: Conditional

Where possible, this endpoint attempts to provide real time responses to allow 3rd parties to integrate with Aurora in the more responsive way possible, however, if the endpoint is not used efficiently, it will differ it's responses as documented here.

Requests to the StockGet method will be deferred where:

  • There is no limit or a limit greater than 1000 and none of the following are true:
    • There are more than 200 Product References specified (or not specified at all).
    • The Interval specified is greater than 30 minutes (or not specified).

To avoid getting deferred responses from this method, please consider limiting requests by the above conditions.

This endpoint supports paging as documented here.

Example request by SKU:

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraRequestEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header>
                 <AuthToken>...</AuthToken>
         </Header>
         <Requests>
                 <Request>
                         <Stock>
                                 <Get>
                                         <RequestID>1</RequestID>
                                         <ProductReferences>
                                                 <ProductReference>SKU1</ProductReference>
                                                 <ProductReference>SKU2</ProductReference>
                                                 <ProductReference>SKU3</ProductReference>
                                         </ProductReferences>
                                 </Get>
                         </Stock>
                 </Request>
         </Requests>
 </AuroraRequestEnvelope>

Example request by Interval (the last day):

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraRequestEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header>
                 <AuthToken>...</AuthToken>
         </Header>
         <Requests>
                 <Request>
                         <Stock>
                                 <Get>
                                         <RequestID>1</RequestID>
                                         <Interval>PT15M</Interval>
                                 </Get>
                         </Stock>
                 </Request>
         </Requests>
 </AuroraRequestEnvelope>

Since v1.1 of the API, the individual Store Stock levels are returned as show in the example below.

Example response with stores:

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraResponseEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Header>
                <Summary>
                        <Ack>OK</Ack>
                        <RequestsProcessed>1</RequestsProcessed>
                        <RequestsSucceeded>1</RequestsSucceeded>
                        <RequestErrors>0</RequestErrors>
                </Summary>
        </Header>
        <Responses>
                <Response>
                        <RequestID>1</RequestID>
                        <Ack>OK</Ack>
                        <Data>
                                <Product>
                                        <ProductReference>SKU1</ProductReference>
                                        <ProductStock>35</ProductStock>
                                        <PreOrderStock></PreOrderStock>
                                        <Stores>
                                                <Store>
                                                        <StoreID>1</StoreID>
                                                        <StoreReference>XYZ</StoreReference>
                                                        <Stock>20</Stock>
                                                </Store>
                                                <Store>
                                                        <StoreID>2</StoreID>
                                                        <StoreReference>ABC</StoreReference>
                                                        <Stock>15</Stock>
                                                </Store>
                                        </Stores>
                                </Product>
                        </Data>
                </Response>
         </Responses>
 </AuroraResponseEnvelope>

Request Fields

FieldValuesVersionDescriptionRequired
IntervalString interval1.1+P indicates the period (required)

nY indicates the number of years

nM indicates the number of months

nD indicates the number of days

T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)

nH indicates the number of hours

nM indicates the number of minutes

nS indicates the number of seconds
No

(If not provided, no interval filter is applied, and all products are returned.)
ProductReferencesContainer1.0+No
ProductReferences.ProductReferenceString1.0+This can be the Product or Variation Reference/SKUNo
ProductReferences.InternalStoreIDString1.1+This takes the Internal Store Reference/ID given to a product in the Store Stock systemNo
DetailLevelMinimum
or
Minimum Products or
Minimum Variations or
Full
1.5+This allows the client to request varying volumes of data when receiving data back from the server (defaults to "Minimum")

Minimum returns individual stock for both products and variations
Minimum Products returns individual stock for products only
Minimum Variations returns individual stock for variations only
Full returns individual stock for products with variation stock grouped within each product
No

Response fields

FieldValuesAPI VersionDescriptionDetail Levels
<br>Product<br>Container1.0+Minimum +
Product.ProductReferenceString1.0+The main Product Reference or Variation Reference (usually the SKU) assigned to the Product.

This will always be a Main Product Reference when Detail Level is Full, but may be either a product or variation reference if not.
Minimum +
Product.ProductStockInteger1.0+The current stock level for a Product.Minimum +
Product.PreOrderStockInteger1.0+The limit to which this product can be pre-ordered. This can be blank to show that there is no limit.Minimum +
Product.StoresContainer1.1+Minimum +
Product.Stores.StoreContainer1.1+Minimum +
Product.Stores.Store.StoreIDInteger > 01.1+The Internal ID Aurora uses to identify a Store.Minimum +
Product.Stores.Store.StoreReferenceString1.1+The Internal ID Aurora uses to identify a Product.Minimum +
Product.Stores.Store.StockInteger1.1+The Internal ID Aurora uses to identify a Product.Minimum +
Product.VariationsContainer1.3+Full
Product.Variations.VariationContainer1.3+Full
Product.Variations.Variation.VariationReferenceString1.3+The main Product Reference (usually the SKU) assigned to the Product Variation.Full
Product.Variations.Variation.VariationStockInteger1.3+The current stock level for a Product Variation.Full
Product.Variations.Variation.VariationPreOrderStockInteger1.3+The limit to which this Product Variation can be pre-ordered. This can be blank to show that there is no limit.Full

Update

Since: v1.1

Deferred: No

This method allows the Stock of Products and their Variations to be updated quickly. Stock can be managed at two levels:

  • Master Stock level on the products or variations as a whole
  • Store Stock level on the products or variations for each individual store

If you manage your stock by store, then the 'Master Stock' levels for each product or variation will be calculated automatically based on a SUM of all stock levels from all stores. This can be prevented by passing the 'generate_stock_from_stores' attribute of the 'Update' tag as 'no'. In this case, the 'Master Stock' levels for the products updated at Store level will not be changed in response to these Store level stock changes. Please see some examples below.

Example request to set master stock:

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraRequestEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header>
                 <AuthToken>...</AuthToken>
         </Header>
         <Requests>
                 <Request>
                         <Stock>
                                 <Update>
                                         <RequestID>1</RequestID>
                                         <ProductReference>SKU1</ProductReference>
                                         <Stock>1</Stock>
                                         <PreOrderStock>1</PreOrderStock>
                                 </Update>
                         </Stock>
                         <Stock>
                                 <Update>
                                         <RequestID>2</RequestID>
                                         <ProductReference>SKU2</ProductReference>
                                         <Stock>1</Stock>
                                         <PreOrderStock>1</PreOrderStock>
                                 </Update>
                         </Stock>
                 </Request>
         </Requests>
 </AuroraRequestEnvelope>

Example request to set store stock:

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraRequestEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header>
                 <AuthToken>...</AuthToken>
         </Header>
         <Requests>
                 <Request>
                         <Stock>
                                 <Update>
                                         <RequestID>1</RequestID>
                                         <ProductReference>SKU1</ProductReference>
                                         <StoreReference>XYZ</StoreReference>
                                         <Stock>1</Stock>
                                 </Update>
                         </Stock>
                 </Request>
         </Requests>
 </AuroraRequestEnvelope>

Example request to set store stock while not effecting the master stock:

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraRequestEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header>
                 <AuthToken>...</AuthToken>
         </Header>
         <Requests>
                 <Request>
                         <Stock>
                                 <Update generate_stock_from_stores="no">
                                         <RequestID>1</RequestID>
                                         <ProductReference>SKU1</ProductReference>
                                         <StoreReference>XYZ</StoreReference>
                                         <Stock>1</Stock>
                                 </Update>
                         </Stock>
                 </Request>
         </Requests>
 </AuroraRequestEnvelope>

Example response:

 <?xml version="1.0" encoding="utf-8"?>
 <AuroraResponseEnvelope>
        <Header>
                <Summary>
                        <Ack>OK</Ack>
                        <RequestsProcessed>1</RequestsProcessed>
                        <RequestsSucceeded>1</RequestsSucceeded>
                        <RequestErrors>0</RequestErrors>
                </Summary>
        </Header>
        <Responses>
                <Response>
                        <RequestID>1</RequestID>
                        <Ack>OK</Ack>
                </Response>
                <Response>
                        <RequestID>2</RequestID>
                        <Ack>OK</Ack>
                </Response>
         </Responses>
</AuroraResponseEnvelope>

Request Fields

FieldValuesDescriptionRequired
RequestIDInteger > 0The ID of the Message, assigned to the return messages for error handlingNo
ProductReferenceAlpha-numeric StringThis is the Product Reference set for the product or variation in Aurora (usually the product SKU)One of at least ProductReference, ProductEAN, ProductID, VariationID must be provided
ProductEANAlpha-numeric StringThis is the Product EAN set for the product or variation in Aurora (usually the product barcode)One of at least ProductReference, ProductEAN, ProductID, VariationID must be provided
ProductIDInteger > 0This is the Internal Product ID given to the product by AuroraOne of at least ProductReference, ProductEAN, ProductID, VariationID must be provided
VariationIDInteger > 0This is the Internal Variation ID given to the product by AuroraOne of at least ProductReference, ProductEAN, ProductID, VariationID must be provided
StoreIDInteger > 0This is the Internal Store ID given to the product by AuroraIf StoreID is provided then StoreReference cannot be
StoreReferenceAlpha-numeric StringThis is the Unique Store Reference set for the store in AuroraIf StoreReference is provided then StoreID cannot be
StockInteger >= 0The current stock for the product or variationThis is optional unless a StoreID or StoreReference has been provided
PreOrderStockInteger >= 0 or blankThe current pre-order stock for the product or variation (pre-order stock levels are not supported at a Store level)If StoreReference or StoreID have been provided then this field cannot be