Im trying to describe all the sobjects in my organization and fetch some information from each of them. When I use the partner wsdl, I can give something like this in c#

DescribeGlobalResult dgr = binding.describeGlobal();
string[] objs = dgr.sobjects.Where(obj => obj.createable == true && obj.layoutable == true).Select(obj => obj.name).ToArray();
List<DescribeSObjectResult> lstSObjectDescribeResults = binding.describeSObjects(objs).ToList();

If I need to do the same thing using rest api (Passing sobject list in one call and retrieving the describe result as a list) how should i do? is it possible?

As of now using rest api I have to give like this for doing a describeglobal :-

// HttpGet creates a webrequest and using the get method 
// and the oauth access token it gets a json response.

strHttpResponse = HttpGet(string.Format(@"{0}/services/data/v{1}/sobjects/", token.instance_url, LatestApiVersion), "");

and for getting describe result for all my sobjects I have to do like this :-

// Assume that I have parsed all my objects retrieved through the describeglobal rest 
// call and having the object names as string array in a variable called sobjects

foreach(var currentobject in sobjects)
     strHttpResponse = HttpGet(string.Format(@"{0}/services/data/v{1}/sobjects/{2}/describe/",token.instance_url, LatestApiVersion, currentobject), "");

so this code will be doing a webrequest for each object, if I am having 400 objects it will take more time to create a webrequest and get the response again and again, is there any way to send the list of sobjects in bulk thru rest api and get the response as a json array containing a separate json describe result for each of the sobject passed as a list?

2 Answers 2


The standard REST API only provides doing object describes on single objects at a time. http://www.salesforce.com/us/developer/docs/api_rest/Content/dome_sobject_basic_info.htm

You could try creating a custom REST API using Apex REST and returning the map of objects:

Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); 

You would have to cast the Schema.SObjectType object to a custom object first before returning it though.

Something like the following...

global class RESTTest 
    global static Map<String, TestObj> getGlobalDescribe()
        //TODO: iterate through Schema.getGlobalDescribe() method results and
        //cast results to custom object below

        return null;

    global class TestObj
        global String name;
        //TODO: add more properties as needed

This code hasn't been tested by the way, is just meant to help point you in the right direction.

Check out more information on Dynamic Apex here: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_describe_objects_understanding.htm#apex_describe_object_access_all

Let me know if you have any questions.

  • In addition to that the global describe has many flags from the detailed describe, its worth reviewing if you actually need the detailed describe of all objects. (which is expensive however you do it)
    – superfell
    Mar 19, 2013 at 1:04
  • My application has to work dynamically across organizations so I cant do this :( So should I have to use only the partner wsdl and describe these objects? Is that the only way?
    – Sathya
    Mar 19, 2013 at 1:05
  • @superfell thanks for the information I had a look at it but i want to find the dependencies (child relationships) of each object and order it from the least to the most so that i can load data from one SF environment (Source) to other (target) thru the tool am developing. To do this, if I need dependencies, the global describe doesnt have this information, any suggestions on achieving this?
    – Sathya
    Mar 19, 2013 at 1:08
  • @Sathya where you able to solve the problem for multiple accounts
    – Sar009
    Apr 28, 2017 at 10:20
  • @Sar009 See My Answer about Batch Api Jan 16, 2020 at 15:32

There is a Batch Api that can get upto 25 requests in one go.

POST to "https://{YOUR_INSTANCE}.salesforce.com/services/data/v{API_VERSION}/composite/batch"

    "Content-Type": "application/json"

    "batchRequests": [
            method: "GET",
            url: "v{VERSION}/sobjects/{SOBJECT_NAME}/describe"
            method: "GET",
            url: "v{VERSION}/sobjects/{SOBJECT_NAME}/describe"

        ... upto 25 requests

This does not need any changes on the org.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .