Square.Connect.Api.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 (BatchChangeInventoryRequest 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

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class BatchChangeInventoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

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

            try
            {
                // BatchChangeInventory
                BatchChangeInventoryResponse result = apiInstance.BatchChangeInventory(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.BatchChangeInventory: " + e.Message );
            }
        }
    }
}

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

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

BatchRetrieveInventoryChanges

BatchRetrieveInventoryChangesResponse BatchRetrieveInventoryChanges (BatchRetrieveInventoryChangesRequest 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

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class BatchRetrieveInventoryChangesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

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

            try
            {
                // BatchRetrieveInventoryChanges
                BatchRetrieveInventoryChangesResponse result = apiInstance.BatchRetrieveInventoryChanges(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.BatchRetrieveInventoryChanges: " + e.Message );
            }
        }
    }
}

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

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

BatchRetrieveInventoryCounts

BatchRetrieveInventoryCountsResponse BatchRetrieveInventoryCounts (BatchRetrieveInventoryCountsRequest 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

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class BatchRetrieveInventoryCountsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

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

            try
            {
                // BatchRetrieveInventoryCounts
                BatchRetrieveInventoryCountsResponse result = apiInstance.BatchRetrieveInventoryCounts(body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.BatchRetrieveInventoryCounts: " + e.Message );
            }
        }
    }
}

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

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

RetrieveInventoryAdjustment

RetrieveInventoryAdjustmentResponse RetrieveInventoryAdjustment (string adjustmentId)

RetrieveInventoryAdjustment

Returns the InventoryAdjustment object with the provided adjustment_id.

Example

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class RetrieveInventoryAdjustmentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new InventoryApi();
            var adjustmentId = adjustmentId_example;  // string | ID of the `InventoryAdjustment` to retrieve.

            try
            {
                // RetrieveInventoryAdjustment
                RetrieveInventoryAdjustmentResponse result = apiInstance.RetrieveInventoryAdjustment(adjustmentId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.RetrieveInventoryAdjustment: " + e.Message );
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
adjustmentIdstringID of the `InventoryAdjustment` to retrieve.

Return type

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

RetrieveInventoryChangesResponse RetrieveInventoryChanges (string catalogObjectId, string locationIds = null, string cursor = null)

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

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class RetrieveInventoryChangesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new InventoryApi();
            var catalogObjectId = catalogObjectId_example;  // string | ID of the `CatalogObject` to retrieve.
            var locationIds = locationIds_example;  // string | The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. (optional) 
            var 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. (optional) 

            try
            {
                // RetrieveInventoryChanges
                RetrieveInventoryChangesResponse result = apiInstance.RetrieveInventoryChanges(catalogObjectId, locationIds, cursor);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.RetrieveInventoryChanges: " + e.Message );
            }
        }
    }
}

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

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

RetrieveInventoryCount

RetrieveInventoryCountResponse RetrieveInventoryCount (string catalogObjectId, string locationIds = null, string cursor = null)

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

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class RetrieveInventoryCountExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new InventoryApi();
            var catalogObjectId = catalogObjectId_example;  // string | ID of the `CatalogObject` to retrieve.
            var locationIds = locationIds_example;  // string | The `Location` IDs to look up as a comma-separated list. An empty list queries all locations. (optional) 
            var 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. (optional) 

            try
            {
                // RetrieveInventoryCount
                RetrieveInventoryCountResponse result = apiInstance.RetrieveInventoryCount(catalogObjectId, locationIds, cursor);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.RetrieveInventoryCount: " + e.Message );
            }
        }
    }
}

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

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

RetrieveInventoryPhysicalCount

RetrieveInventoryPhysicalCountResponse RetrieveInventoryPhysicalCount (string physicalCountId)

RetrieveInventoryPhysicalCount

Returns the InventoryPhysicalCount object with the provided physical_count_id.

Example

using System;
using System.Diagnostics;
using Square.Connect.Api;
using Square.Connect.Client;
using Square.Connect.Model;

namespace Example
{
    public class RetrieveInventoryPhysicalCountExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: oauth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new InventoryApi();
            var physicalCountId = physicalCountId_example;  // string | ID of the `InventoryPhysicalCount` to retrieve.

            try
            {
                // RetrieveInventoryPhysicalCount
                RetrieveInventoryPhysicalCountResponse result = apiInstance.RetrieveInventoryPhysicalCount(physicalCountId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling InventoryApi.RetrieveInventoryPhysicalCount: " + e.Message );
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
physicalCountIdstringID of the `InventoryPhysicalCount` to retrieve.

Return type

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]