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
Lukesh KarmoreLukesh Karmore 

what is the use of RestRequest req = RestContext.request;

in following code 

@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
@HttpGet
global static Account doGet() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId]; return result;
}
}
what is the use of this bold line in above code can any one explain mein simple words.
thank you
Danish HodaDanish Hoda
Hi Lukesh,
Plz refer https://www.sfdcstop.com/2019/11/salesforce-integration-tutorial-part-3.html for better understanding on the Integration part.
VinayVinay (Salesforce Developers) 

Hi Lukesh,

Check below references that can give you more details.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_restrequest.htm
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_sample_restrequest.htm
http://amitsalesforce.blogspot.com/2016/04/rest-api-in-salesforce-execute-rest-api.html

Thanks,