2

I keep getting the following compile error on my HTTP request, Compile Error: Method does not exist or incorrect signature: [System.HttpRequest].setHeader(Blob), Here's my code:

    HttpRequest req = new HttpRequest();
    HttpResponse res = new HttpResponse();
    Http http = new Http();

    req.setMethod('POST' ); // Method Type

    req.setEndpoint('web210.ntree.com/twig-cstc3/v1/login');//salestree url
    Blob LoginBlob = Blob.valueof(loginstring);
    req.setHeader('Content-Type','application/json');
    req.setHeader(LoginBlob);

    res = http.send(req);
    if(res.getBody() != null){
    }

Any help would be appreciated

1 Answer 1

5

If you look at the documentation you will see that the only setHeader method available has this signature:

public Void setHeader(String key, String value)

In HTTP, headers each have a name and value so you need to supply both.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .