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?
-
2Possibly related: salesforce.stackexchange.com/questions/102259/…– Adrian Larson ♦Mar 8, 2016 at 17:04
-
Thanks @AdrianLarson .. Thanks for that.. Saw the question. there isn't a concrete answer on when we use what... few points seems to be ambiguous... Expecting a properly justified answer with reference...– Kannan RamamoorthyMar 8, 2016 at 17:12
-
1Duplicate of: salesforce.stackexchange.com/questions/77683/…– Scott PelakMar 8, 2016 at 17:24
-
@ʞɐʃǝԀʇʇoɔS Not sure I agree with that one. Related, not duplicate.– Adrian Larson ♦Mar 8, 2016 at 17:25
-
@ʞɐʃǝԀʇʇoɔS Thank you.. that link is also helpful...– Kannan RamamoorthyMar 8, 2016 at 20:37
1 Answer
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.
-
1Of 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.– sfdcfoxMar 8, 2016 at 17:40