Skip to content

Latest commit

 

History

History
363 lines (240 loc) · 14.3 KB

InventoryApi.md

File metadata and controls

363 lines (240 loc) · 14.3 KB

SquareConnect.InventoryApi

All URIs are relative to https://connect.squareup.com

Method HTTP request Description
batchChangeInventory POST /v2/inventory/batch-change BatchChangeInventory
batchRetrieveInventoryChanges POST /v2/inventory/batch-retrieve-changes BatchRetrieveInventoryChanges
batchRetrieveInventoryCounts POST /v2/inventory/batch-retrieve-counts BatchRetrieveInventoryCounts
retrieveInventoryAdjustment GET /v2/inventory/adjustment/{adjustment_id} RetrieveInventoryAdjustment
retrieveInventoryChanges GET /v2/inventory/{catalog_object_id}/changes RetrieveInventoryChanges
retrieveInventoryCount GET /v2/inventory/{catalog_object_id} RetrieveInventoryCount
retrieveInventoryPhysicalCount GET /v2/inventory/physical-count/{physical_count_id} RetrieveInventoryPhysicalCount

batchChangeInventory

BatchChangeInventoryResponse batchChangeInventory(body)

BatchChangeInventory

Applies adjustments and counts to the provided item quantities. On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var body = new SquareConnect.BatchChangeInventoryRequest(); // BatchChangeInventoryRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.batchChangeInventory(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
body BatchChangeInventoryRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

BatchChangeInventoryResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

batchRetrieveInventoryChanges

BatchRetrieveInventoryChangesResponse batchRetrieveInventoryChanges(body)

BatchRetrieveInventoryChanges

Returns historical physical counts and adjustments based on the provided filter criteria. Results are paginated and sorted in ascending order according their `occurred_at` timestamp (oldest first). BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var body = new SquareConnect.BatchRetrieveInventoryChangesRequest(); // BatchRetrieveInventoryChangesRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.batchRetrieveInventoryChanges(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
body BatchRetrieveInventoryChangesRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

BatchRetrieveInventoryChangesResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

batchRetrieveInventoryCounts

BatchRetrieveInventoryCountsResponse batchRetrieveInventoryCounts(body)

BatchRetrieveInventoryCounts

Returns current counts for the provided CatalogObjects at the requested Locations. Results are paginated and sorted in descending order according to their `calculated_at` timestamp (newest first). When `updated_after` is specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a "sync" operation, for example in response to receiving a Webhook notification.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var body = new SquareConnect.BatchRetrieveInventoryCountsRequest(); // BatchRetrieveInventoryCountsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

apiInstance.batchRetrieveInventoryCounts(body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
body BatchRetrieveInventoryCountsRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

BatchRetrieveInventoryCountsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveInventoryAdjustment

RetrieveInventoryAdjustmentResponse retrieveInventoryAdjustment(adjustmentId)

RetrieveInventoryAdjustment

Returns the InventoryAdjustment object with the provided `adjustment_id`.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var adjustmentId = "adjustmentId_example"; // String | ID of the `InventoryAdjustment` to retrieve.

apiInstance.retrieveInventoryAdjustment(adjustmentId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
adjustmentId String ID of the `InventoryAdjustment` to retrieve.

Return type

RetrieveInventoryAdjustmentResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveInventoryChanges

RetrieveInventoryChangesResponse retrieveInventoryChanges(catalogObjectId, opts)

RetrieveInventoryChanges

Returns a set of physical counts and inventory adjustments for the provided CatalogObject at the requested Locations. Results are paginated and sorted in descending order according to their `occurred_at` timestamp (newest first). There are no limits on how far back the caller can page. This endpoint can be used to display recent changes for a specific item. For more sophisticated queries, use a batch endpoint.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var catalogObjectId = "catalogObjectId_example"; // String | ID of the `CatalogObject` to retrieve.

var opts = { 
  'locationIds': "locationIds_example", // String | The `Location` IDs to look up as a comma-separated list. An empty list queries all locations.
  'cursor': "cursor_example" // String | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.  See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
};
apiInstance.retrieveInventoryChanges(catalogObjectId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
catalogObjectId String ID of the `CatalogObject` to retrieve.
locationIds String The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. [optional]
cursor String A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the Pagination guide for more information. [optional]

Return type

RetrieveInventoryChangesResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveInventoryCount

RetrieveInventoryCountResponse retrieveInventoryCount(catalogObjectId, opts)

RetrieveInventoryCount

Retrieves the current calculated stock count for a given CatalogObject at a given set of Locations. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var catalogObjectId = "catalogObjectId_example"; // String | ID of the `CatalogObject` to retrieve.

var opts = { 
  'locationIds': "locationIds_example", // String | The `Location` IDs to look up as a comma-separated list. An empty list queries all locations.
  'cursor': "cursor_example" // String | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query.  See the [Pagination](https://developer.squareup.com/docs/docs/working-with-apis/pagination) guide for more information.
};
apiInstance.retrieveInventoryCount(catalogObjectId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
catalogObjectId String ID of the `CatalogObject` to retrieve.
locationIds String The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. [optional]
cursor String A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See the Pagination guide for more information. [optional]

Return type

RetrieveInventoryCountResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

retrieveInventoryPhysicalCount

RetrieveInventoryPhysicalCountResponse retrieveInventoryPhysicalCount(physicalCountId)

RetrieveInventoryPhysicalCount

Returns the InventoryPhysicalCount object with the provided `physical_count_id`.

Example

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SquareConnect.InventoryApi();

var physicalCountId = "physicalCountId_example"; // String | ID of the `InventoryPhysicalCount` to retrieve.

apiInstance.retrieveInventoryPhysicalCount(physicalCountId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
physicalCountId String ID of the `InventoryPhysicalCount` to retrieve.

Return type

RetrieveInventoryPhysicalCountResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json