Posts

Salesforce Integration using REST API

Image
  Salesforce Integration using REST API To make your Apex class available as a REST web service is straightforward. Define your class as global. and define methods as global static. Add annotations to the class and methods. For example, this sample Apex REST class uses one method. The getRecord method is a custom REST API call. It’s annotated with @HttpGet and is invoked for a GET request. @RestResource(urlMapping=’/Account/*’) global with sharing class MyRestResource { @HttpGet global static Account getRecord() { // Add your code } The class is annotated with  @RestResource(urlMapping=’/Account/*’) . The base endpoint for Apex REST is  https:// yourInstance .salesforce.com/services/apexrest/ The URL mapping is appended to the base endpoint to form the endpoint for your REST service. For example, in the class example, the REST endpoint is https:// yourInstance .salesforce.com/services/apexrest/ For your org, it could look something like, https:// yourI...