4

I have an IOS app and I want to make sure I minimally use the API request to parse.com due to the 30/sec request limitation on the free tier. Could some one please clarify if saving disparate PFObjects in one method call "[PFObject saveAll:NSArray]" amounts to 1 API call or multiple API calls.

I need a definite answer since there is no clear answer anywhere on the interwebs. Parse.com support please help since I want to code the implementation differently if it accounts for many API requests in which case I will make sure I have better error handling when I save each pfObject separately.

Thanks.

user2733554
  • 117
  • 1
  • 7

5 Answers5

6

From Parse:

saveAll attempts to do as few API calls as possible. Usually a call to saveAll results in only one API request. However, if any of the objects in the set has a relation to another unsaved object, that object will have to be saved first, resulting in more API requests.

https://www.parse.com/questions/saveall-how-many-api-requests

Michael Peterson
  • 10,383
  • 3
  • 54
  • 51
5

I'm using PFObject saveAllInBackground:block and regardless if there's a relation to another unsaved object, my api count in Analytics always increases by the number of objects in the array.

Feta
  • 522
  • 1
  • 5
  • 11
5

With Parse moving to the new pricing model they also changed the way batch operation requests (e.g. saveAll) are counted:

Where previously batch requests counted as a single request, it now takes n requests (where n is the number of objects passed to saveAll).

There was a extension of the old way of counting for apps that were already depending on it, but as of February 2015 batch operations like saveAll use 1 request per object

Niklas Fasching
  • 1,326
  • 11
  • 15
1

From what I have seen using Parse, saving many PFObjects accounts as 1 API call.

However, the thing I don't know about is that if there are any limits on the number of objects to be saved at once and still be considered as 1 API call.

Also I recommend that you test it yourself. Try saving multiple objects at once and see how your API calls number change in the dashboard.

Please note that batch operations will fail as a whole if one object fails (e.g. object does not exist).

ahmdx
  • 881
  • 7
  • 13
  • Thanks for your answer. Do you know if there is any limit to the size of data we can save by using the batch saveAll method. I know that there is a 128kb limit to the size of each save request, how does this work for saveAll ? – user2733554 Sep 05 '14 at 23:13
  • The size limit is not on the save request, it is on the object itself (i.e. no single PFObject must be greater than 128KB in size). As for the batch operations, Parse claims no limit on the number of objects to be saved by saveAll: "There is no documented limit, and saveAll will batch your save requests to minimize the number of API requests that are needed, but I'd be wary of a saveAll operation that requires saving up to 10,000 objects from a mobile client." This was an answer given by someone working at Parse for the number limit question. https://parse.com/questions/saveall-limit – ahmdx Sep 06 '14 at 03:55
  • Do we know if it still only takes 1 request? Have a look at my question here: http://stackoverflow.com/q/27434349/3194789 – dcgoss Jan 01 '15 at 07:54
1

For me saveAll is also using as many API calls as objects are saved. I think they changed this with the new pricing and this is a non-sense, since one user saving multiple data at once generates an insane peak on the Api consumption.

GuillermoMP
  • 1,694
  • 16
  • 19
  • 1
    I agree with you, but it's worth noting that the limit is calculated on a per minute basis, so the free limit is 1,800 per minute, not strictly 30 per second. – blwinters May 09 '15 at 14:40
  • I know, but this is risky for apps that rely on offline modes or do heavy sync batches. Also, for their systems processing 1 batched save N call is way cheaper than procesing N independent calls, which is the whole point & benefit of batching. If they then charge the developer the same "price" for batches and independant calls, its just unfair. – GuillermoMP Jan 24 '16 at 10:01