inventory_api = client.inventory
InventoryApi
- Retrieve Inventory Adjustment
- Batch Change Inventory
- Batch Retrieve Inventory Changes
- Batch Retrieve Inventory Counts
- Retrieve Inventory Physical Count
- Retrieve Inventory Count
- Retrieve Inventory Changes
Returns the InventoryAdjustment object
with the provided adjustment_id
.
def retrieve_inventory_adjustment(self,
adjustment_id)
Parameter | Type | Tags | Description |
---|---|---|---|
adjustment_id |
string |
Template, Required | ID of the InventoryAdjustment to retrieve. |
Retrieve Inventory Adjustment Response
adjustment_id = 'adjustment_id0'
result = inventory_api.retrieve_inventory_adjustment(adjustment_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
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.
def batch_change_inventory(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Batch Change Inventory Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Batch Change Inventory Response
body = {}
body['idempotency_key'] = '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe'
body['changes'] = []
body['changes'].append({})
body['changes'][0]['type'] = 'PHYSICAL_COUNT'
body['changes'][0]['physical_count'] = {}
body['changes'][0]['physical_count']['id'] = 'id0'
body['changes'][0]['physical_count']['reference_id'] = '1536bfbf-efed-48bf-b17d-a197141b2a92'
body['changes'][0]['physical_count']['catalog_object_id'] = 'W62UWFY35CWMYGVWK6TWJDNI'
body['changes'][0]['physical_count']['catalog_object_type'] = 'catalog_object_type4'
body['changes'][0]['physical_count']['state'] = 'IN_STOCK'
body['changes'][0]['physical_count']['location_id'] = 'C6W5YS5QM06F5'
body['changes'][0]['physical_count']['quantity'] = '53'
body['changes'][0]['physical_count']['employee_id'] = 'LRK57NSQ5X7PUD05'
body['changes'][0]['physical_count']['occurred_at'] = '2016-11-16T22:25:24.878Z'
body['changes'][0]['adjustment'] = {}
body['changes'][0]['adjustment']['id'] = 'id6'
body['changes'][0]['adjustment']['reference_id'] = 'reference_id4'
body['changes'][0]['adjustment']['from_state'] = 'SOLD'
body['changes'][0]['adjustment']['to_state'] = 'SOLD_ONLINE'
body['changes'][0]['adjustment']['location_id'] = 'location_id0'
body['changes'][0]['transfer'] = {}
body['changes'][0]['transfer']['id'] = 'id0'
body['changes'][0]['transfer']['reference_id'] = 'reference_id8'
body['changes'][0]['transfer']['state'] = 'UNLINKED_RETURN'
body['changes'][0]['transfer']['from_location_id'] = 'from_location_id2'
body['changes'][0]['transfer']['to_location_id'] = 'to_location_id2'
body['changes'][0]['measurement_unit'] = {}
body['changes'][0]['measurement_unit']['measurement_unit'] = {}
body['changes'][0]['measurement_unit']['measurement_unit']['custom_unit'] = {}
body['changes'][0]['measurement_unit']['measurement_unit']['custom_unit']['name'] = 'name0'
body['changes'][0]['measurement_unit']['measurement_unit']['custom_unit']['abbreviation'] = 'abbreviation2'
body['changes'][0]['measurement_unit']['measurement_unit']['area_unit'] = 'IMPERIAL_SQUARE_FOOT'
body['changes'][0]['measurement_unit']['measurement_unit']['length_unit'] = 'METRIC_METER'
body['changes'][0]['measurement_unit']['measurement_unit']['volume_unit'] = 'METRIC_MILLILITER'
body['changes'][0]['measurement_unit']['measurement_unit']['weight_unit'] = 'IMPERIAL_WEIGHT_OUNCE'
body['changes'][0]['measurement_unit']['precision'] = 26
body['ignore_unchanged_counts'] = True
result = inventory_api.batch_change_inventory(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
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.
def batch_retrieve_inventory_changes(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Batch Retrieve Inventory Changes Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Batch Retrieve Inventory Changes Response
body = {}
body['catalog_object_ids'] = ['W62UWFY35CWMYGVWK6TWJDNI']
body['location_ids'] = ['C6W5YS5QM06F5']
body['types'] = ['PHYSICAL_COUNT']
body['states'] = ['IN_STOCK']
body['updated_after'] = '2016-11-01T00:00:00.000Z'
body['updated_before'] = '2016-12-01T00:00:00.000Z'
result = inventory_api.batch_retrieve_inventory_changes(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
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.
def batch_retrieve_inventory_counts(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Batch Retrieve Inventory Counts Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Batch Retrieve Inventory Counts Response
body = {}
body['catalog_object_ids'] = ['W62UWFY35CWMYGVWK6TWJDNI']
body['location_ids'] = ['59TNP9SA8VGDA']
body['updated_after'] = '2016-11-16T00:00:00.000Z'
body['cursor'] = 'cursor0'
body['states'] = ['SUPPORTED_BY_NEWER_VERSION']
result = inventory_api.batch_retrieve_inventory_counts(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Returns the InventoryPhysicalCount
object with the provided physical_count_id
.
def retrieve_inventory_physical_count(self,
physical_count_id)
Parameter | Type | Tags | Description |
---|---|---|---|
physical_count_id |
string |
Template, Required | ID of the InventoryPhysicalCount to retrieve. |
Retrieve Inventory Physical Count Response
physical_count_id = 'physical_count_id2'
result = inventory_api.retrieve_inventory_physical_count(physical_count_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
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.
def retrieve_inventory_count(self,
catalog_object_id,
location_ids=None,
cursor=None)
Parameter | Type | Tags | Description |
---|---|---|---|
catalog_object_id |
string |
Template, Required | ID of the CatalogObject to retrieve. |
location_ids |
string |
Query, Optional | The Location IDs to look up as a comma-separated list. An empty list queries all locations. |
cursor |
string |
Query, Optional | 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. |
Retrieve Inventory Count Response
catalog_object_id = 'catalog_object_id6'
location_ids = 'location_ids0'
cursor = 'cursor6'
result = inventory_api.retrieve_inventory_count(catalog_object_id, location_ids, cursor)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
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 can be used to display recent changes for a specific item. For more sophisticated queries, use a batch endpoint.
def retrieve_inventory_changes(self,
catalog_object_id,
location_ids=None,
cursor=None)
Parameter | Type | Tags | Description |
---|---|---|---|
catalog_object_id |
string |
Template, Required | ID of the CatalogObject to retrieve. |
location_ids |
string |
Query, Optional | The Location IDs to look up as a comma-separated list. An empty list queries all locations. |
cursor |
string |
Query, Optional | 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. |
Retrieve Inventory Changes Response
catalog_object_id = 'catalog_object_id6'
location_ids = 'location_ids0'
cursor = 'cursor6'
result = inventory_api.retrieve_inventory_changes(catalog_object_id, location_ids, cursor)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)