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?
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.