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);

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

Any help would be appreciated


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.