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
Allen2Allen2 

Please help me out to write the code for this apex class...........

public class Sendp_SubsCToFu {       
    
    public MRes getRows (String sField, String sValue) {
            HttpResponse response;
            String[] eId;
            
            if(sField == 'AN') {
              response = makeGetCallout('anp', sValue);
              sValue = '';
            }
            else if(sField == 'ExternalId') {
                eId = sValue.split(':');
                response = makeGetCallout('conId', eId[0]);
            }
            // Parse the JSON response and populate the rows.
            System.debug('response'+response.getBody());
            MRes resp = (MRes)JSON.deserialize(response.getBody(), MRes.class);                       
            System.debug('resp'+resp); 
            return resp;        
        }       
        
        private HttpResponse makeGetCallout(String sAttr, String sValue) {
        P_Int_Details__c int = P_Int_Details__c.getValues('Saas');
            HttpRequest req = new HttpRequest();
            req.setHeader('Content-Type', int.Interface_Title__c);
            req.setHeader('Authorization', 'Basic ' + EncodingUtil.base64Encode(Blob.valueOf(int.Username__c+':'+int.Password__c)));
            req.setEndpoint(int.End_Point_URL__c+'&'+ sAttr + '=' + sValue ); 
            req.setMethod(int.Http_Method__c);
            req.setTimeout(Integer.valueOf(int.Timeout__c));
            HttpResponse res =new Http().send(req);
            return res;
        }
}