I am using the Salesforce Mobile SDK 2.0 to build a connected Salesforce Native iOS app, I would like to be able to run reports programatically using the SFRestRequest method (or some other method?), can you show code examples of how this might be done? Secondly, is it also possible to send filter parameters through to the report as well, such as account id? My code snippet in its current state (I am able:

SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:@"SELECT id, Image_Filename__c FROM product2 WHERE (Group__c !='Discontinued') ORDER BY name ASC"];
[[SFRestAPI sharedInstance] send:request delegate:self];
  • 2
    I am not familiar with XCode, but i would start by looking at the recently announced GA of the Salesforce Analytics API, salesforce.com/us/developer/docs/api_analytics/index.htm, "The REST-based Analytics API gives you programmatic access to your report data as defined in the report builder. The API lets you integrate the data into any web or mobile application, inside or outside the Salesforce platform. For example, you might use the API to trigger a Chatter post with a snapshot of top-performing reps each quarter." Oct 21, 2013 at 15:35
  • Thanks @AndrewFawcett I have been through that and it is useful to a point BUT what I don't understand, as I was saying above, is how to package the query and read the return results.
    – Bartley
    Oct 21, 2013 at 16:10
  • There seems to be a standard SF REST API support class here, forcedotcom.github.io/SalesforceMobileSDK-iOS/Documentation/…, with some examples. If I was you i would use curl to confirm the REST API call you want make fits the bill and then try to interpret the SFRestAPI class examples to make the call. Oct 21, 2013 at 17:05

1 Answer 1


so goodnews/badnews:

Good news, I can tell you how to do this.

Bad news, you're going to write your own objective-c methods because the Salesforce Mobile IOS Sdk only wraps the sObject api.

Ideally, you'd replicate the architecture of the sfRestRequest and SFRestApi, setting it up to hit the resource that Andrew Fawcett mentioned above to retrieve your data as json.

Specifically, your custom cloned sfRestRequest class needs to set the resource url, and the SFRestApi needs to have a method to call the analytics api with your new sfRestRequest cloned class.

Once you've written obj-c methods to hit: /services/data/<latest API version>/analytics/reports/<report ID> with your ReportID, you'll be returned a JSON payload.

That json payload can be parsed as normal!

  • Thanks Kevin, it's comforting to know that you can tell me how to do this, can you actually tell me how to do this though? I would love you to spend some time on your answer explaining HOW to do this, e.g., step 1, step 2. etc.
    – Bartley
    Oct 23, 2013 at 8:21
  • Kevin, can you share some details on the HOW part of your answer?
    – Bartley
    Oct 30, 2013 at 7:34
  • @Reaper As I said before, You'll need to extend the Salesforce iOS SDK. This involves writing obj-c code. You'll need, as I said, to add methods to hit the rest apis for for the analytics api.
    – Kevin P
    Oct 30, 2013 at 13:37
  • I can write Obj-c code but I don't know to hit the rest api's, do you have any sample code?
    – Bartley
    Oct 30, 2013 at 13:46
  • Check out the source code for the Salesforce iOS SDK, it's open source (for the most part.) You can find it here: github.com/forcedotcom/SalesforceMobileSDK-iOS/tree/master/…
    – Kevin P
    Oct 30, 2013 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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