INTEGRATION

<<<<<<Salesforce Integration Interview questions>>>>>>

Apex REST Annotations In Salesforce

@RestResource
The @RestResource annotation is used at the class level and enables us to expose an Apex class as a REST resource.
To use @RestResource annotation, an Apex class must be defined as global.

@HttpDelete
This deletes the specified resource.

@HttpGet
This returns the specified resource.

@HttpPatch
This updates the specified resource.

@HttpPost
This creates a new resource.

@HttpPut
This creates or updates the specified resource.
To use @HttpDelete, @HttpGet, @HttpPatch, @HttpPost, @HttpPut Apex method must be defined as global static.

What is the difference between @HttpPatch & @HttpPut in Salesforce?

@HttpPatch
This updates the specified resource.Replace the part of  resource with the request received.
@HttpPut
This creates or updates the specified resource.Replace the entire resource with the request received.

@RestResource(urlMapping='/getAccountOnExternalIdtofetchsinglerecord/*')
   global with sharing class getAccounttoSingleRecord {
      @Httpget
      global static Account fetchAccount(){
        Account obj=new Account();
        RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;
        string accId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        obj=[Select id , name from Account where id=:accId];
        return obj;
      }
   }

What is OAuth 2.0 Username-Password Flow In Salesforce

How to work OAuth 2.0 Web Server Flow for Web App Integration in Salesforce

Scanario 1. Just taking about live scenario, For now we have two ORG, ORG A and another ORG B.What we will doing today is we will try to fetch an account from ORG B and show that using the Visualforce page in ORG A.

Scanario 2. Just taking about live scenario, For now we have two ORG, ORG A and another ORG B. ORG A record will pass to ORG B webservice, The webservice will than create the same record in ORG B.