-1

This question already has an answer here:

HttpRequest req = new HttpRequest();
Http http = new Http();
req.setTimeout(120000);
req.setHeader('Content-Type','application/json');   
req.setHeader('x-api-key', apikey);
req.setendpoint(endPointUrl);
req.setBody(requestBody);
req.setmethod('POST');
HttPResponse res = http.send(req);
System.debug('Status'+res.getstatuscode());
System.debug('Body'+ res.getBody());        
if (res.getStatusCode() == 200) {
    responseLoanSummaryParser(res.getBody());
} else {
    throw new EncompassException('Error Occured While doing Webservice Callout.');
}

marked as duplicate by Tushar Sharma, Oleksandr Berehovskyi, Reshma, Dave Humm, David Reed Feb 4 at 12:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Please include what you have already created for the test class and clarify the problem in the question rather than just code - see How to Ask and take the tour to get the best out of the site. – Dave Humm Feb 4 at 11:50

Browse other questions tagged or ask your own question.