The data browser is built for Chrome, Firefox, Safari, and IE9 and above. Please upgrade your browser, or download Google Chrome to get the best experience.
Back to Questions

Support for Batch and Get

0 votes     1 answer     919 views     

0

I just tried to perform a GET request in a Batch and was told (well, the API responded ;) that it was not allowed. Is there a reason for this? I'm trying to get aggregate data for my content. So I want to do a get where I pass count:1 and limit:0. I need to sum up the count for 3 types of data. Obviously I could do 3 HTTP calls, but one batch could would be better I think.

Have you considered doing something with Cloud Code do achieve this?

- John Psuik about 1 year ago

I'm sure that would work. But I'm more curious as to why you can't batch/get in the first place.

- Raymond Camden about 1 year ago

1 Answer

0

I'm not quite sure I get the issue. Isn't a batch GET just a query? The batch API only supports POST because that's how we create/update several objects at once.

Here is a specific example. Using a query, I can ask Parse to return the count of items in a table where property X = 1. Now imagine I want to do this for X=2 and X=3 (my column X can only have 3 values). I'm doing this so I can build a report. If I could do a batch GET, I would. But because I can't do that, I have to run 3 separate GETs. Make sense? Here is a blog post where I discuss it: http://www.raymondcamden.com/index.cfm/2013/2/22/Integrating-Parsecom-on-the-Server

- Raymond Camden about 1 year ago

Could you do this in a cloud function? In general gets are slow so we don't like to batch them up. If we did, many users would hit the 30 second timeout we have on requests to Parse.

- Shyam about 1 year ago

Yes, I suppose so. What if BATCH allowed GETs where the limit was always 0? :)

- Raymond Camden about 1 year ago

Counts are fairly slow, so count queries are more likely to take longer than regular queries with limits.

- Shyam about 1 year ago

Fair enough. I'd definitely cache this server-side if I used it in production.

- Raymond Camden about 1 year ago