SquareConnect::InventoryApi

March 13, 2019 ยท View on GitHub

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

MethodHTTP requestDescription
batch_change_inventoryPOST /v2/inventory/batch-changeBatchChangeInventory
batch_retrieve_inventory_changesPOST /v2/inventory/batch-retrieve-changesBatchRetrieveInventoryChanges
batch_retrieve_inventory_countsPOST /v2/inventory/batch-retrieve-countsBatchRetrieveInventoryCounts
retrieve_inventory_adjustmentGET /v2/inventory/adjustment/{adjustment_id}RetrieveInventoryAdjustment
retrieve_inventory_changesGET /v2/inventory/{catalog_object_id}/changesRetrieveInventoryChanges
retrieve_inventory_countGET /v2/inventory/{catalog_object_id}RetrieveInventoryCount
retrieve_inventory_physical_countGET /v2/inventory/physical-count/{physical_count_id}RetrieveInventoryPhysicalCount

batch_change_inventory

BatchChangeInventoryResponse batch_change_inventory(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

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

body = SquareConnect::BatchChangeInventoryRequest.new # BatchChangeInventoryRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.


begin
  #BatchChangeInventory
  result = api_instance.batch_change_inventory(body)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->batch_change_inventory: #{e}"
end

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

batch_retrieve_inventory_changes

BatchRetrieveInventoryChangesResponse batch_retrieve_inventory_changes(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

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

body = SquareConnect::BatchRetrieveInventoryChangesRequest.new # BatchRetrieveInventoryChangesRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.


begin
  #BatchRetrieveInventoryChanges
  result = api_instance.batch_retrieve_inventory_changes(body)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->batch_retrieve_inventory_changes: #{e}"
end

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

batch_retrieve_inventory_counts

BatchRetrieveInventoryCountsResponse batch_retrieve_inventory_counts(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

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

body = SquareConnect::BatchRetrieveInventoryCountsRequest.new # BatchRetrieveInventoryCountsRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.


begin
  #BatchRetrieveInventoryCounts
  result = api_instance.batch_retrieve_inventory_counts(body)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->batch_retrieve_inventory_counts: #{e}"
end

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

retrieve_inventory_adjustment

RetrieveInventoryAdjustmentResponse retrieve_inventory_adjustment(adjustment_id)

RetrieveInventoryAdjustment

Returns the InventoryAdjustment object with the provided adjustment_id.

Example

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

adjustment_id = "adjustment_id_example" # String | ID of the [InventoryAdjustment](#type-inventoryadjustment) to retrieve.


begin
  #RetrieveInventoryAdjustment
  result = api_instance.retrieve_inventory_adjustment(adjustment_id)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->retrieve_inventory_adjustment: #{e}"
end

Parameters

NameTypeDescriptionNotes
adjustment_idStringID of the InventoryAdjustment to retrieve.

Return type

RetrieveInventoryAdjustmentResponse

Authorization

oauth2

HTTP request headers

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

retrieve_inventory_changes

RetrieveInventoryChangesResponse retrieve_inventory_changes(catalog_object_id, opts)

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

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

catalog_object_id = "catalog_object_id_example" # String | ID of the [CatalogObject](#type-catalogobject) to retrieve.

opts = { 
  location_ids: "location_ids_example", # String | The [Location](#type-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 [Pagination](/basics/api101/pagination) for more information.
}

begin
  #RetrieveInventoryChanges
  result = api_instance.retrieve_inventory_changes(catalog_object_id, opts)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->retrieve_inventory_changes: #{e}"
end

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 Pagination for more information.[optional]

Return type

RetrieveInventoryChangesResponse

Authorization

oauth2

HTTP request headers

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

retrieve_inventory_count

RetrieveInventoryCountResponse retrieve_inventory_count(catalog_object_id, opts)

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

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

catalog_object_id = "catalog_object_id_example" # String | ID of the [CatalogObject](#type-catalogobject) to retrieve.

opts = { 
  location_ids: "location_ids_example", # String | The [Location](#type-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 [Pagination](/basics/api101/pagination) for more information.
}

begin
  #RetrieveInventoryCount
  result = api_instance.retrieve_inventory_count(catalog_object_id, opts)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->retrieve_inventory_count: #{e}"
end

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 Pagination for more information.[optional]

Return type

RetrieveInventoryCountResponse

Authorization

oauth2

HTTP request headers

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

retrieve_inventory_physical_count

RetrieveInventoryPhysicalCountResponse retrieve_inventory_physical_count(physical_count_id)

RetrieveInventoryPhysicalCount

Returns the InventoryPhysicalCount object with the provided physical_count_id.

Example

# load the gem
require 'square_connect'
# setup authorization
SquareConnect.configure do |config|
  # Configure OAuth2 access token for authorization: oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = SquareConnect::InventoryApi.new

physical_count_id = "physical_count_id_example" # String | ID of the [InventoryPhysicalCount](#type-inventoryphysicalcount) to retrieve.


begin
  #RetrieveInventoryPhysicalCount
  result = api_instance.retrieve_inventory_physical_count(physical_count_id)
  p result
rescue SquareConnect::ApiError => e
  puts "Exception when calling InventoryApi->retrieve_inventory_physical_count: #{e}"
end

Parameters

NameTypeDescriptionNotes
physical_count_idStringID of the InventoryPhysicalCount to retrieve.

Return type

RetrieveInventoryPhysicalCountResponse

Authorization

oauth2

HTTP request headers

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