Getting all items via API
I want to sync pricing and inventory from PHP POS to my WooCommerce shop via Integromat Make. My Integromat scenario is:
- Get all items from PHP POS via API https://mystore.phppointofsale.com/index.php/api/v1/items?limit=99999
- Iterate through each item
- Find the matching product in WooCommerce
- Update the product
Unfortunately it looks like the API only returns a maximum of 100 items. Is there any way I can get more items?
Comments
2 comments
You can by using the offset and the limit. The calls are limited to 100 to avoid spam and overloading the server with requests; hence, affecting your POS overall performance.
For example, you'll need to set the first offset = 0 and limit = 100. Add a sleep of about 60 seconds before running the next call setting offset = 101 and again limit 100. Repeat until you reach your item limits.
Sleep (60)
You can edit file \apps\phppos\htdocs\application\controllers\api\v1\Items.php
Find string
$limit = 100;
and edit it like that:
$limit = 100000;
or just delete this string
Please sign in to leave a comment.