Getting all items via API

David Wang

I want to sync pricing and inventory from PHP POS to my WooCommerce shop via Integromat Make. My Integromat scenario is:

  1. Get all items from PHP POS via API https://mystore.phppointofsale.com/index.php/api/v1/items?limit=99999
  2. Iterate through each item
  3. Find the matching product in WooCommerce
  4. 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

  • Comment author
    Ken N.
    • Edited

    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.

    https://demo.phppointofsale.com/index.php/api/v1/items?offset=0&limit=100

    Sleep (60)

    https://demo.phppointofsale.com/index.php/api/v1/items?offset=100&limit=100

     

    0
  • Comment author
    Denis Grubenko
    • Edited

    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 

    0

Please sign in to leave a comment.