1

Currently, I want to do a mass update of products account codes. However, I am hitting an API limit as we will need to retrieve the item first before doing an update. So the code currently is like this

foreach($products as $product)
   loadByGUID to get GUID of product&services
   setAccountCode of product&services
   save()

I understand there is also a saveAll() function which i could use, which im not too sure how to use. But what if my number of products that i need to loadByGUID exceeds the api limit ?

Example, i am preparing to update 10 k products to an account code. But since there is an API limit i will hit this

XeroPHP\Remote\Exception\RateLimitExceededException: The API rate limit for your organisation/application pairing has been exceeded. in /var/www/xxxxxx/vendor/calcinai/xero-php/src/XeroPHP/Remote/Response.php:111
Napmi
  • 521
  • 2
  • 13
  • 32
  • 1
    Can you retrieve the GUIDs in blocks, and then update the accountcode in those same blocks? So perhaps get all the GUIDs, map your account codes to them, then update them in blocks of 50? I've been storing GUIDs in my local system to minimise the number of checks I have to do prior to sending information to Xero, just to try to keep below the limits. – droopsnoot Sep 03 '19 at 11:40
  • could you show me an example of how you would use saveAll() ? Cause currently now , im getting this error ``` Call to a member function saveAll() on array ``` – Napmi Sep 04 '19 at 10:59
  • Sorry, I can't, just because I am using vb.net rather than PHP for my Xero connection. You can look at the source for the `saveAll()` function in Github and see if it helps you out. – droopsnoot Sep 05 '19 at 08:25

0 Answers0