Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting subresources alongside products (not separately) #96

Open
dsoprea opened this issue May 14, 2021 · 1 comment
Open

Getting subresources alongside products (not separately) #96

dsoprea opened this issue May 14, 2021 · 1 comment

Comments

@dsoprea
Copy link

dsoprea commented May 14, 2021

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?

@WillAyd
Copy link

WillAyd commented Apr 18, 2022

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants