Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Latest commit

 

History

History
394 lines (285 loc) · 16.4 KB

InventoryApi.md

File metadata and controls

394 lines (285 loc) · 16.4 KB

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

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
BatchChangeInventoryRequest body = new BatchChangeInventoryRequest(); // BatchChangeInventoryRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    BatchChangeInventoryResponse result = apiInstance.batchChangeInventory(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#batchChangeInventory");
    e.printStackTrace();
}

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

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
BatchRetrieveInventoryChangesRequest body = new BatchRetrieveInventoryChangesRequest(); // BatchRetrieveInventoryChangesRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    BatchRetrieveInventoryChangesResponse result = apiInstance.batchRetrieveInventoryChanges(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#batchRetrieveInventoryChanges");
    e.printStackTrace();
}

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

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
BatchRetrieveInventoryCountsRequest body = new BatchRetrieveInventoryCountsRequest(); // BatchRetrieveInventoryCountsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    BatchRetrieveInventoryCountsResponse result = apiInstance.batchRetrieveInventoryCounts(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#batchRetrieveInventoryCounts");
    e.printStackTrace();
}

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

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
String adjustmentId = "adjustmentId_example"; // String | ID of the `InventoryAdjustment` to retrieve.
try {
    RetrieveInventoryAdjustmentResponse result = apiInstance.retrieveInventoryAdjustment(adjustmentId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#retrieveInventoryAdjustment");
    e.printStackTrace();
}

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, locationIds, cursor)

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 is useful when displaying recent changes for a specific item. For more sophisticated queries, use a batch endpoint.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
String catalogObjectId = "catalogObjectId_example"; // String | ID of the `CatalogObject` to retrieve.
String locationIds = "locationIds_example"; // String | The `Location` IDs to look up as a comma-separated list. An empty list queries all locations.
String 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.
try {
    RetrieveInventoryChangesResponse result = apiInstance.retrieveInventoryChanges(catalogObjectId, locationIds, cursor);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#retrieveInventoryChanges");
    e.printStackTrace();
}

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, locationIds, cursor)

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

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
String catalogObjectId = "catalogObjectId_example"; // String | ID of the `CatalogObject` to retrieve.
String locationIds = "locationIds_example"; // String | The `Location` IDs to look up as a comma-separated list. An empty list queries all locations.
String 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.
try {
    RetrieveInventoryCountResponse result = apiInstance.retrieveInventoryCount(catalogObjectId, locationIds, cursor);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#retrieveInventoryCount");
    e.printStackTrace();
}

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

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.InventoryApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

InventoryApi apiInstance = new InventoryApi();
String physicalCountId = "physicalCountId_example"; // String | ID of the `InventoryPhysicalCount` to retrieve.
try {
    RetrieveInventoryPhysicalCountResponse result = apiInstance.retrieveInventoryPhysicalCount(physicalCountId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling InventoryApi#retrieveInventoryPhysicalCount");
    e.printStackTrace();
}

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