Skip to content

Latest commit

 

History

History
599 lines (423 loc) · 19.2 KB

inventory.md

File metadata and controls

599 lines (423 loc) · 19.2 KB

Inventory

inventory_api = client.inventory

Class Name

InventoryApi

Methods

Deprecated Retrieve Inventory Adjustment

This endpoint is deprecated.

Deprecated version of RetrieveInventoryAdjustment after the endpoint URL is updated to conform to the standard convention.

def deprecated_retrieve_inventory_adjustment(self,
                                            adjustment_id)

Parameters

Parameter Type Tags Description
adjustment_id str Template, Required ID of the InventoryAdjustment to retrieve.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Adjustment Response.

Example Usage

adjustment_id = 'adjustment_id0'

result = inventory_api.deprecated_retrieve_inventory_adjustment(adjustment_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Retrieve Inventory Adjustment

Returns the InventoryAdjustment object with the provided adjustment_id.

def retrieve_inventory_adjustment(self,
                                 adjustment_id)

Parameters

Parameter Type Tags Description
adjustment_id str Template, Required ID of the InventoryAdjustment to retrieve.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Adjustment Response.

Example Usage

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)

Deprecated Batch Change Inventory

This endpoint is deprecated.

Deprecated version of BatchChangeInventory after the endpoint URL is updated to conform to the standard convention.

def deprecated_batch_change_inventory(self,
                                     body)

Parameters

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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Batch Change Inventory Response.

Example Usage

body = {
    'idempotency_key': '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe',
    'changes': [
        {
            'type': 'PHYSICAL_COUNT',
            'physical_count': {
                'reference_id': '1536bfbf-efed-48bf-b17d-a197141b2a92',
                'catalog_object_id': 'W62UWFY35CWMYGVWK6TWJDNI',
                'state': 'IN_STOCK',
                'location_id': 'C6W5YS5QM06F5',
                'quantity': '53',
                'team_member_id': 'LRK57NSQ5X7PUD05',
                'occurred_at': '2016-11-16T22:25:24.878Z'
            }
        }
    ],
    'ignore_unchanged_counts': True
}

result = inventory_api.deprecated_batch_change_inventory(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Deprecated Batch Retrieve Inventory Changes

This endpoint is deprecated.

Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL is updated to conform to the standard convention.

def deprecated_batch_retrieve_inventory_changes(self,
                                               body)

Parameters

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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Batch Retrieve Inventory Changes Response.

Example Usage

body = {
    'catalog_object_ids': [
        'W62UWFY35CWMYGVWK6TWJDNI'
    ],
    'location_ids': [
        'C6W5YS5QM06F5'
    ],
    'types': [
        'PHYSICAL_COUNT'
    ],
    'states': [
        'IN_STOCK'
    ],
    'updated_after': '2016-11-01T00:00:00.000Z',
    'updated_before': '2016-12-01T00:00:00.000Z'
}

result = inventory_api.deprecated_batch_retrieve_inventory_changes(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Deprecated Batch Retrieve Inventory Counts

This endpoint is deprecated.

Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL is updated to conform to the standard convention.

def deprecated_batch_retrieve_inventory_counts(self,
                                              body)

Parameters

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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Batch Retrieve Inventory Counts Response.

Example Usage

body = {
    'catalog_object_ids': [
        'W62UWFY35CWMYGVWK6TWJDNI'
    ],
    'location_ids': [
        '59TNP9SA8VGDA'
    ],
    'updated_after': '2016-11-16T00:00:00.000Z'
}

result = inventory_api.deprecated_batch_retrieve_inventory_counts(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Batch Change Inventory

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)

Parameters

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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Batch Change Inventory Response.

Example Usage

body = {
    'idempotency_key': '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe',
    'changes': [
        {
            'type': 'PHYSICAL_COUNT',
            'physical_count': {
                'reference_id': '1536bfbf-efed-48bf-b17d-a197141b2a92',
                'catalog_object_id': 'W62UWFY35CWMYGVWK6TWJDNI',
                'state': 'IN_STOCK',
                'location_id': 'C6W5YS5QM06F5',
                'quantity': '53',
                'team_member_id': 'LRK57NSQ5X7PUD05',
                'occurred_at': '2016-11-16T22:25:24.878Z'
            }
        }
    ],
    '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)

Batch Retrieve Inventory Changes

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)

Parameters

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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Batch Retrieve Inventory Changes Response.

Example Usage

body = {
    'catalog_object_ids': [
        'W62UWFY35CWMYGVWK6TWJDNI'
    ],
    'location_ids': [
        'C6W5YS5QM06F5'
    ],
    'types': [
        'PHYSICAL_COUNT'
    ],
    'states': [
        'IN_STOCK'
    ],
    'updated_after': '2016-11-01T00:00:00.000Z',
    '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)

Batch Retrieve Inventory Counts

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)

Parameters

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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Batch Retrieve Inventory Counts Response.

Example Usage

body = {
    'catalog_object_ids': [
        'W62UWFY35CWMYGVWK6TWJDNI'
    ],
    'location_ids': [
        '59TNP9SA8VGDA'
    ],
    'updated_after': '2016-11-16T00:00:00.000Z'
}

result = inventory_api.batch_retrieve_inventory_counts(body)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Deprecated Retrieve Inventory Physical Count

This endpoint is deprecated.

Deprecated version of RetrieveInventoryPhysicalCount after the endpoint URL is updated to conform to the standard convention.

def deprecated_retrieve_inventory_physical_count(self,
                                                physical_count_id)

Parameters

Parameter Type Tags Description
physical_count_id str Template, Required ID of the
InventoryPhysicalCount to retrieve.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Physical Count Response.

Example Usage

physical_count_id = 'physical_count_id2'

result = inventory_api.deprecated_retrieve_inventory_physical_count(physical_count_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Retrieve Inventory Physical Count

Returns the InventoryPhysicalCount object with the provided physical_count_id.

def retrieve_inventory_physical_count(self,
                                     physical_count_id)

Parameters

Parameter Type Tags Description
physical_count_id str Template, Required ID of the
InventoryPhysicalCount to retrieve.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Physical Count Response.

Example Usage

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)

Retrieve Inventory Transfer

Returns the InventoryTransfer object with the provided transfer_id.

def retrieve_inventory_transfer(self,
                               transfer_id)

Parameters

Parameter Type Tags Description
transfer_id str Template, Required ID of the InventoryTransfer to retrieve.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Transfer Response.

Example Usage

transfer_id = 'transfer_id6'

result = inventory_api.retrieve_inventory_transfer(transfer_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Retrieve Inventory Count

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)

Parameters

Parameter Type Tags Description
catalog_object_id str Template, Required ID of the CatalogObject to retrieve.
location_ids str Query, Optional The Location IDs to look up as a comma-separated
list. An empty list queries all locations.
cursor str 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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Count Response.

Example Usage

catalog_object_id = 'catalog_object_id6'

result = inventory_api.retrieve_inventory_count(catalog_object_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)

Retrieve Inventory Changes

This endpoint is deprecated.

Returns a set of physical counts and inventory adjustments for the provided CatalogObject at the requested Locations.

You can achieve the same result by calling BatchRetrieveInventoryChanges and having the catalog_object_ids list contain a single element of the CatalogObject ID.

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)

Parameters

Parameter Type Tags Description
catalog_object_id str Template, Required ID of the CatalogObject to retrieve.
location_ids str Query, Optional The Location IDs to look up as a comma-separated
list. An empty list queries all locations.
cursor str 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.

Response Type

This method returns a ApiResponse instance. The body property of this instance returns the response data which is of type Retrieve Inventory Changes Response.

Example Usage

catalog_object_id = 'catalog_object_id6'

result = inventory_api.retrieve_inventory_changes(catalog_object_id)

if result.is_success():
    print(result.body)
elif result.is_error():
    print(result.errors)