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

Latest commit

 

History

History
359 lines (243 loc) · 15.8 KB

InventoryApi.md

File metadata and controls

359 lines (243 loc) · 15.8 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

\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

Name Type Description Notes
body \SquareConnect\Model\BatchChangeInventoryRequest An 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

Name Type Description Notes
body \SquareConnect\Model\BatchRetrieveInventoryChangesRequest An 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

Name Type Description Notes
body \SquareConnect\Model\BatchRetrieveInventoryCountsRequest An 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

Name Type Description Notes
adjustment_id string ID 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($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

Name Type Description Notes
catalog_object_id string ID of the `CatalogObject` to retrieve.
location_ids 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

\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($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

Name Type Description Notes
catalog_object_id string ID of the `CatalogObject` to retrieve.
location_ids 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

\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

Name Type Description Notes
physical_count_id string ID 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]