Skip to content

Getting subresources alongside products (not separately) #96

Open

Description

@dsoprea

The API supports getting subresources within the same request as products:

image

However, the client seems to only provide access one at a time via a separate API call.

image

There's no way to just request products and subresources in one call?

Activity

  1. WillAyd commented on Apr 18, 2022

    @WillAyd

    I had a similar issue with OrderCoupons. The problem is that these subresources use ListableApiSubResource but the iterall method you probably want is on the ListableApiResource mix in

    You can work around this with a monkey patch at runtime if you do something like this:

    class ListableOrderCoupons(bigcommerce.api.OrderCoupons, bigcommerce.api.ListableApiResource):
        pass
    
    ...
    # at runtime add this monkeypatch to the API obj
    conn.ListableOrderCoupons = bigcommerce.api.ApiResourceWrapper(ListableOrderCoupons, conn)
    
    # now can just call...
    foo = conn.ListableOrderCoupons.iterall()
    ...

    not winning any awards for cleanest code but should work in a pinch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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