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
Ameer Basha 34Ameer Basha 34 

How to Get Multiple Record ID's from GetRequest.requestURI from HTTPGET

Hi everyone,

I got struct from hours I am unable to find how to get multiple record id's from HTTP Get request i.e;

RestRequest GetRequest = RestContext.request;
        RestResponse GetResponse = RestContext.response;
        String AccountId = GetRequest.requestURI.substring(GetRequest.requestURI.lastIndexOf('/')+1);

the above is getting single record id. I want to get Multiple Record id's means of list of id's...Please help me on this..Thanks in Advance...
SwethaSwetha (Salesforce Developers) 
HI Ameer,
Does https://salesforce.stackexchange.com/questions/239876/how-to-use-httpget-service-to-get-a-list-of-objects-and-create-them help?

The approach is to try something like 
RestRequest req = RestContext.request;
    Integer rowsToSkip=Integer.valueOf( req.requestURI.substring(req.requestURI.lastIndexOf('/')+1));

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Ameer Basha 34Ameer Basha 34
Hi Swetha,

Thank You for your response,

RestRequest GetRequest = RestContext.request;
        RestResponse GetResponse = RestContext.response;
        String AccountId = GetRequest.requestURI.substring(GetRequest.requestURI.lastIndexOf('/')+1);
        List<String> ids = AccountId.split(',');
        set<Id> SetOfLeadIds= new set<Id>();
         for(Id idOf : ids){
           SetOfLeadIds.add(idOf);
            system.debug(idOf);
        }
        
        List<Account> AccountsAndChildRecords = [select id,Name From Account WHERE Id IN :SetOfLeadIds];

I have written like this and I got the output..

Thank You,
Ameer