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
devgpldevgpl 

How can i cretae a REST API in salesforce.

Hi All,

         How can i  cretae a REST API in salesforce. i created a remote access in my dev org.

How can i create REST API Classs and Visualforce Page. in dev org.

 

please any one help me .

 

Thanks in Advance.

Peter_sfdcPeter_sfdc

devgpl wrote:

Hi All,

         How can i  cretae a REST API in salesforce.

 

 


Hi Devgpi, 

 

My first question is why do you want to write a REST API in Apex? Have you attempted to use one of the standard REST APIs? You can certainly write Apex code that exposes a global method which can then be called by an external system. But you should for sure attempt to use one of the standard REST APIs first. Check the REST API docs on developerforce. And play around with the workbench REST explorer to understand better what is possible for making an inbound call to your org from an external system


devgpl wrote:

 i created a remote access in my dev org. 

 


Remote Access is not necessarily relevant to the creation of your REST functionality in Apex. Remote access (which have been renamed to connected applications in newer orgs) allows you to perform an OAuth flow for the purposes of authentication. You'll need information from the Remote Access in your client application. But that doesn't necessarily enable you to write the Apex code. 


devgpl wrote:

How can i create REST API Classs and Visualforce Page. in dev org.


Where does the Visualforce page come into things. If you are exposing a custom REST web service, you don't need a visualforce page for this. The REST endpoint is defined in Apex only. 

If you have an outbound integration, Visualforce may come into it where your VF page might call the outbound integration endpoint. But what is your Visualforce supposed to do. 

 

Can you take some time to explain a bit further what your business requirements are. That  might help us turn around and help you understand what the best strategy is, whether you need to write a custom REST endpoint in Apex or not, do you need Visualforce, etc. 

 

I'd also like to suggest you take some time to review this article on Integration and it's associated sub-articles to get a better understanding of what the capabilities are when integrating Force.com with an external system. If you have training budget, you might also look into the Integrating with Force.com (DEV-502) training class, which is 4 days of everything integration related on the platform.