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

Latest commit

 

History

History
391 lines (261 loc) · 13.9 KB

InventoryApi.md

File metadata and controls

391 lines (261 loc) · 13.9 KB

SquareConnect::InventoryApi

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

Method HTTP request Description
batch_change_inventory POST /v2/inventory/batch-change BatchChangeInventory
batch_retrieve_inventory_changes POST /v2/inventory/batch-retrieve-changes BatchRetrieveInventoryChanges
batch_retrieve_inventory_counts POST /v2/inventory/batch-retrieve-counts BatchRetrieveInventoryCounts
retrieve_inventory_adjustment GET /v2/inventory/adjustment/{adjustment_id} RetrieveInventoryAdjustment
retrieve_inventory_changes GET /v2/inventory/{catalog_object_id}/changes RetrieveInventoryChanges
retrieve_inventory_count GET /v2/inventory/{catalog_object_id} RetrieveInventoryCount
retrieve_inventory_physical_count GET /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

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

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

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

Name Type Description Notes
adjustment_id String ID 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

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

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

Name Type Description Notes
physical_count_id String ID of the InventoryPhysicalCount to retrieve.

Return type

RetrieveInventoryPhysicalCountResponse

Authorization

oauth2

HTTP request headers

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