Skip to content

Shipment Items are not returned in OrderShipments #120

@joegarcia

Description

@joegarcia

Hello,

So when using the OrderShipments, it seems that the items are not returned. I'm surprised no one has found this sooner, or maybe there's some sort of work around or something.

Here's how to produce it.

       api = bigcommerce.api.BigcommerceApi(
            client_id=client_id,
            access_token=access_token,
            store_hash=store_hash,
            rate_limiting_management={'min_requests_remaining': 2,'wait': True,'callback_function': None}
        )
        order_id = <enter order id>
        shipments = api.OrderShipments.all(parentid=order_id)
        for s in shipments:
            print(s)

The result will have the following keys:
id
order_id
customer_id
order_address_id
date_created
tracking_number
merchant_shipping_cost
shipping_method
comments
shipping_provider
tracking_carrier
tracking_link
billing_address
shipping_address
generated_tracking_link
shipping_provider_display_name

items is missing from that list.

This is how I verified that there was missing data:

       # using requests library
        headers = {
            "Accept": "application/json",
            "Content-Type": "application/json",
            "X-Auth-Client": client_id,
            "X-Auth-Token": access_token
        }
        url = f"https://api.bigcommerce.com/stores/{store_hash}/v2/orders/{order_id}/shipments"
        params = {"limit": 250}
        response = requests.get(url=url, headers=headers, params=params)
        if response.ok:
            for s in response.json():
                print(f"{s}")

Here's the list of keys for that request:
id
order_id
customer_id
order_address_id
date_created
tracking_number
merchant_shipping_cost
shipping_method
comments
shipping_provider
tracking_carrier
tracking_link
billing_address
shipping_address
items
generated_tracking_link
shipping_provider_display_name

You'll notice that items is included in the result.

My suspicion is that when the BigCommerce Python library is building the object, it probably encounters an issue because there's a items() method exists so continues with the next data point.

I hope this helps to fix the issue, or if there's a work around then please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions