When I have a necessity to have my app get data from SF frequently(once in 30sec), what would be the best approach? Can we go with SOQL or a custom REST API code which allows us to get the data?


1 Answer 1


Just based on this document, I would say that you should probably go with the standard REST API if you want to minimize development time. If you are just performing basic queries, it will be much simpler to implement.

The main exception to the above, I would say, is if you want to perform post-processing or aggregation. Using Apex REST, you will be better able to support this functionality.

When to Use REST API
REST API provides a powerful, convenient, and simple REST-based Web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it’s an excellent choice of technology for use with mobile applications and Web projects. However, if you have many records to process, consider using Bulk API, which is based on REST principles and optimized for large sets of data.

When to Use Apex REST API
Use Apex REST API when you want to expose your Apex classes and methods so that external applications can access your code through REST architecture. Apex REST API supports both OAuth 2.0 and Session ID for authorization.

  • 1
    Of course, if you need to aggregate data together from many queries, writing your own API can reduce the chatter between the server and client if you can't wrap the entire thing in to a single query.
    – sfdcfox
    Mar 8, 2016 at 17:40

You must log in to answer this question.

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