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
ankita choudhary 22ankita choudhary 22 

Hi all, Can we give list of ids as a input parameter in Rest get Method?

Hi @ankita choudhary 
I think you can do it but for this you have to customize a little bit .
step 1: Create a RestResources for getCall for whatever object you want for this .
global with sharing class MyRestResource {

    global static List<Case> doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String listcaseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        List<String> listcase= listcaseId.split(',');
        Account result = [SELECT Id, Name FROM Case WHERE Id  IN :listcase ];
        return result;

Step 2 : Whenever you calling rest call for this salesforce object append list of Id with comma separated 
for(String cid : listcid){
StringCaseId =  StringCaseId  +',' + cid;
 url = ''+StringCaseId ;

than you can use this url to put in get  call .