InventoryApi

November 20, 2019 ยท View on GitHub

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

MethodHTTP requestDescription
batchChangeInventoryPOST /v2/inventory/batch-changeBatchChangeInventory
batchRetrieveInventoryChangesPOST /v2/inventory/batch-retrieve-changesBatchRetrieveInventoryChanges
batchRetrieveInventoryCountsPOST /v2/inventory/batch-retrieve-countsBatchRetrieveInventoryCounts
retrieveInventoryAdjustmentGET /v2/inventory/adjustment/{adjustment_id}RetrieveInventoryAdjustment
retrieveInventoryChangesGET /v2/inventory/{catalog_object_id}/changesRetrieveInventoryChanges
retrieveInventoryCountGET /v2/inventory/{catalog_object_id}RetrieveInventoryCount
retrieveInventoryPhysicalCountGET /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

NameTypeDescriptionNotes
bodyBatchChangeInventoryRequestAn 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

NameTypeDescriptionNotes
bodyBatchRetrieveInventoryChangesRequestAn 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

NameTypeDescriptionNotes
bodyBatchRetrieveInventoryCountsRequestAn 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

NameTypeDescriptionNotes
adjustmentIdStringID 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

NameTypeDescriptionNotes
catalogObjectIdStringID of the `CatalogObject` to retrieve.
locationIdsStringThe `Location` IDs to look up as a comma-separated list. An empty list queries all locations.[optional]
cursorStringA 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

NameTypeDescriptionNotes
catalogObjectIdStringID of the `CatalogObject` to retrieve.
locationIdsStringThe `Location` IDs to look up as a comma-separated list. An empty list queries all locations.[optional]
cursorStringA 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

NameTypeDescriptionNotes
physicalCountIdStringID of the `InventoryPhysicalCount` to retrieve.

Return type

RetrieveInventoryPhysicalCountResponse

Authorization

oauth2

HTTP request headers

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