Comments (3)
Hi @sabotagebeats, the pagination values you're referring to come from the V3 BC API, whereas this library is for the older V2 API and has not yet been updated for V3.
For V2, best practice is to take the count and your desired page size to determine the total number of pages over which you'll need to paginate to get all objects, and then paginate them. As per your error message, the maximum page size is 250.
To use the V3 API with this library, you can create an OAuthAPIConnection object directly and change the pathing to /v3/ like so:
v3client = bigcommerce.connection.OAuthConnection(client_id=client_id,
store_hash=store_hash,
access_token=access_token,
api_path='/stores/{}/v3/{}')
This will allow you to use the low-level CRUD interface to interact with the JSON directly, as a workaround for now. An API call would then look like this:
products_response = v3client.get('/catalog/products?limit=%s&page=%s'
% (page_size, current_page))
And you could access the pagination object in the response like this:
products_response['meta']['pagination']
from bigcommerce-api-python.
from bigcommerce-api-python.
Thanks this seems to work:
pCounter = 1 #count the pages - 1st page
totalpages = 1 #currently total pages is 1, changes upon loading api
lookupcategory = 0 #0 for all
api = bigcommerce.api.BigcommerceApi(client_id=clientID, store_hash=store_hash, access_token=accessToken)
count = api.Products.count(category=lookupcategory)
totalpages = count // 250
totalpages = totalpages + 1
print 'There are', count, 'items','in', totalpages, 'total pages'
while pCounter <= totalpages:
product = api.Products.all(category=lookupcategory, page=pCounter)
pCounter += 1
from bigcommerce-api-python.
Related Issues (20)
- Zip payment method not returning in API
- Using v3 Catalog/Product filters HOT 2
- Go SDK + CloudQuery Source Plugin
- I can't get the addresses when I do an api.Customer.all()
- Rate Limit only firing once
- api.Products.count() doesn't work anymore? HOT 2
- 406 Not Acceptable ({"error":"Invalid format."}) during api.oauth_fetch_token call HOT 11
- api.ProductCustomFields.get(productidnumber,fieldidnumber).delete does not delete custom field HOT 1
- Odoo Connector
- ProductVideos cannot create, delete, or delete_all HOT 2
- Unset Price Value On Product Variations HOT 1
- Filter Keyword in API returns only exact match and not partial match
- Order field "custom_status" update returns an error HOT 2
- Seems to be no end point for Blog Tags
- 429 error shouldn't appear should it?
- Order status .iterall() infinite loop
- Updating customer password gives random 400 errors HOT 5
- Is there a way to update products in batches (more than 1 at a time)? HOT 1
- Old releases, broken functions, V3 support HOT 1
- Getting subresources alongside products (not separately) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bigcommerce-api-python.