SquareConnect\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

\SquareConnect\Model\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

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$body = new \SquareConnect\Model\BatchChangeInventoryRequest(); // \SquareConnect\Model\BatchChangeInventoryRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->batchChangeInventory($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->batchChangeInventory: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\BatchChangeInventoryRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\BatchChangeInventoryResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

batchRetrieveInventoryChanges

\SquareConnect\Model\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

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$body = new \SquareConnect\Model\BatchRetrieveInventoryChangesRequest(); // \SquareConnect\Model\BatchRetrieveInventoryChangesRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->batchRetrieveInventoryChanges($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->batchRetrieveInventoryChanges: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\BatchRetrieveInventoryChangesRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\BatchRetrieveInventoryChangesResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

batchRetrieveInventoryCounts

\SquareConnect\Model\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

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$body = new \SquareConnect\Model\BatchRetrieveInventoryCountsRequest(); // \SquareConnect\Model\BatchRetrieveInventoryCountsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->batchRetrieveInventoryCounts($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->batchRetrieveInventoryCounts: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\BatchRetrieveInventoryCountsRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\BatchRetrieveInventoryCountsResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retrieveInventoryAdjustment

\SquareConnect\Model\RetrieveInventoryAdjustmentResponse retrieveInventoryAdjustment($adjustment_id)

RetrieveInventoryAdjustment

Returns the InventoryAdjustment object with the provided adjustment_id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$adjustment_id = "adjustment_id_example"; // string | ID of the `InventoryAdjustment` to retrieve.

try {
    $result = $apiInstance->retrieveInventoryAdjustment($adjustment_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->retrieveInventoryAdjustment: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
adjustment_idstringID of the `InventoryAdjustment` to retrieve.

Return type

\SquareConnect\Model\RetrieveInventoryAdjustmentResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retrieveInventoryChanges

\SquareConnect\Model\RetrieveInventoryChangesResponse retrieveInventoryChanges(catalogobjectid,catalog_object_id, location_ids, $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

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$catalog_object_id = "catalog_object_id_example"; // string | ID of the `CatalogObject` to retrieve.
$location_ids = "location_ids_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.

try {
    $result = $apiInstance->retrieveInventoryChanges($catalog_object_id, $location_ids, $cursor);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->retrieveInventoryChanges: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
catalog_object_idstringID of the `CatalogObject` to retrieve.
location_idsstringThe `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

\SquareConnect\Model\RetrieveInventoryChangesResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retrieveInventoryCount

\SquareConnect\Model\RetrieveInventoryCountResponse retrieveInventoryCount(catalogobjectid,catalog_object_id, location_ids, $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

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$catalog_object_id = "catalog_object_id_example"; // string | ID of the `CatalogObject` to retrieve.
$location_ids = "location_ids_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.

try {
    $result = $apiInstance->retrieveInventoryCount($catalog_object_id, $location_ids, $cursor);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->retrieveInventoryCount: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
catalog_object_idstringID of the `CatalogObject` to retrieve.
location_idsstringThe `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

\SquareConnect\Model\RetrieveInventoryCountResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retrieveInventoryPhysicalCount

\SquareConnect\Model\RetrieveInventoryPhysicalCountResponse retrieveInventoryPhysicalCount($physical_count_id)

RetrieveInventoryPhysicalCount

Returns the InventoryPhysicalCount object with the provided physical_count_id.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\InventoryApi();
$physical_count_id = "physical_count_id_example"; // string | ID of the `InventoryPhysicalCount` to retrieve.

try {
    $result = $apiInstance->retrieveInventoryPhysicalCount($physical_count_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->retrieveInventoryPhysicalCount: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
physical_count_idstringID of the `InventoryPhysicalCount` to retrieve.

Return type

\SquareConnect\Model\RetrieveInventoryPhysicalCountResponse

Authorization

oauth2

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]