function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohit Tyagi SFDMohit Tyagi SFD 

Which one would be better in terms of response time and performance: 1. using an external REST webservice to fetch data from salesforce. OR 2. using apex webservices and call them from the external source to fetch data from Salesforce.

vishal-negandhivishal-negandhi

Hi Mohit, 

If there's a REST resource available in the standard salesforce API's, then ideal way is to always use them. 

Custom Apex webservices should be used when you want to return custom data type. 

With respect to speed and performance, in the end they'll all be Salesforce API's but to avoid maintenance overheads, you should be using the standard salesforce APIs wherever possible. 

Here's a good documentation about which API to be used when - https://help.salesforce.com/articleView?id=integrate_what_is_api.htm&type=5

Hope this helps.

AnudeepAnudeep (Salesforce Developers) 
Hi Mohit - There is really good explanation in this post that I suggest checking