Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a sync engine for a mobile app, and I want to get meta data about the state of a whole lot of different objects in as few API calls as possible. Is it possible to pass more than one SOQL statements in one API call or otherwise combine them? Or would I need to create an Apex class to integrate these different result sets into one Json? Is there a better way?

share|improve this question
The Chatter REST API provides a generic way to combine multiple REST calls into one (see…), but the feature isn't available in the Salesforce REST API yet. – alouie Mar 9 '14 at 0:18
up vote 3 down vote accepted

Perhaps one of the standard APIs can do this - if so hopefully someone will post that answer.

As far as creating your own class, this code compiles:

global with sharing class Reader {
    global static List<List<SObject>> post(List<String> soqls) {
        List<List<SObject>> results = new List<List<SObject>>();
        for (String soql : soqls) {
        return results;

and in theory will return the query results for each SOQL string passed in with the platform taking care of the serialization (to JSON or XML) using its default algorithms.

But if you care about the URL patterns part of REST, using a POST to just GET data is inappropriate. If you don't need to pass the SOQL in, you can of course hard code the SOQL in the class and just use a GET.

share|improve this answer
Custom Apex REST is definitely the way to go. And then you can also create a custom data structure as an Apex class and return that as you data type. So you can combine whatever information you need. – joshbirk Mar 5 '14 at 20:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.