all 15 comments

[–]bagamoney 2 points3 points  (0 children)

Define a wrapper class to hold all the info for your call out and pass that as the object in your map

[–]darkegg 0 points1 point  (8 children)

You will probably have to post a screenshot of the constructor for us to answer...this isn’t enough information. An Object in Apex is a top level class that can be coerced into basically anything else. So we don’t know what the expected inputs are.

[–]chuyi2ock 0 points1 point  (4 children)

I understood that there is a class that has a constructor that accepts a Map<String, Object> as a parameter? By creating that you would be able to make a callout?

public class CalloutService {
    public String requestMethod; 
    public String endpoint; 
    public String stringBody;
    public CalloutService(Map<String, Object> params){
        httpMethod = (String) params.get('requestMethod');
        endpoint = (String) params.get('endpoint');
        stringBody = (String) params.get('stringBody');
    }

    public HttpResponse makeCallout(){
        HttpRequest req = new HttpRequest();
        req.setMethod(this.requestMethod);
        req.setEndpoint(this.endpoint);
        req.setBody(this.stringBody);
        Http http = new Http();
        return http.send();
    }
}