Alokai

reserveInventory

Create or update reservations for a number of location groups, locations, or both. If any of the location groups or locations provided in the request are invalid, nothing is processed.

Calls the createReservations endpoint exposed by SCAPI. *

Signature

export declare function reserveInventory(
	props: ReservationCreateParams
): Promise<ReservationCreateResponse>;

Parameters

NameRequiredTypeDescription
propsRequiredReservationCreateParamsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of the reservation attempt result.

Referenced Types

  • ReservationCreateParams
  • ReservationCreateResponse

Examples

Reserve for locations.

import { sdk } from '~/sdk.config.ts';

const data: ReservationCreateParams = {
  "externalRefId": "7282822-9823-aaa",
  "expirationSeconds": 300,
  "allowPartialReservations": true,
  "reservationTime": "2019-07-24T21:13:00Z",
  "locations": [
    {
      "id": "warehouse5",
      "reservations": [
        {
          "sku": "sku1234",
          "quantity": 10
        }
      ]
    }
  ]
};

const result = await sdk.commerce.reserveInventory(data);

Reserve for locations with all or nothing.

import { sdk } from '~/sdk.config.ts';

const data: ReservationCreateParams = {
  "externalRefId": "7282822-9823-aaa",
  "expirationSeconds": 300,
  "allowPartialReservations": true,
  "reservationTime": "2019-07-24T21:13:00Z",
  "locations": [
    {
      "id": "warehouse5",
      "reservations": [
        {
          "sku": "sku1234",
          "quantity": 10
        }
      ],
      "allOrNothingReservations": [
        {
          "id": "a14s-4b1c-1a3cbd4",
          "reservations": [
            {
              "sku": "sku1234",
              "quantity": 10
            }
          ]
        }
      ]
    }
  ]
};

const result = await sdk.commerce.reserveInventory(data);

Reserve for groups.

import { sdk } from '~/sdk.config.ts';

const data: ReservationCreateParams = {
  "externalRefId": "7282822-9823-aaa",
  "expirationSeconds": 300,
  "allowPartialReservations": true,
  "reservationTime": "2019-07-24T21:13:00Z",
  "groups": [
    {
      "id": "UnitedStates",
      "reservations": [
        {
          "sku": "sku1234",
          "quantity": 10
        }
      ]
    }
  ]
};

const result = await sdk.commerce.reserveInventory(data);

Reserve for location and group.

import { sdk } from '~/sdk.config.ts';

const data: ReservationCreateParams = {
  "externalRefId": "7282822-9823-aaa",
  "expirationSeconds": 300,
  "allowPartialReservations": true,
  "reservationTime": "2019-07-24T21:13:00Z",
  "groups": [
    {
      "id": "UnitedStates",
      "reservations": [
        {
          "sku": "sku1234",
          "quantity": 10
        }
      ]
    }
  ],
  "locations": [
    {
      "id": "warehouse5",
      "reservations": [
        {
          "sku": "sku1234",
          "quantity": 10
        }
      ]
    }
  ]
};

const result = await sdk.commerce.reserveInventory(data);

Reserve for locations ATF.

import { sdk } from '~/sdk.config.ts';

const data: ReservationCreateParams = {
  "externalRefId": "7282822-9823-aaa",
  "expirationSeconds": 300,
  "allowPartialReservations": true,
  "fulfillOnly": true,
  "reservationTime": "2019-07-24T21:13:00Z",
  "locations": [
    {
      "id": "warehouse5",
      "reservations": [
        {
          "sku": "sku1234",
          "quantity": 10
        }
      ]
    }
  ]
};

const result = await sdk.commerce.reserveInventory(data);

On this page