I'm trying to connect to a web portal via API's.

HttpRequest httpRequest = new HttpRequest();
String body='account=xxxx&authenticationkey=xxxxxxxxxxx&username=Tester&id=xxxxx';

Http htt = new hTTP();

 HttpResponse httpRe = htt.send(httpRequest);

 String re = httpRe.geTbody();

The 4 parameters I used are noted in the guide.But it shows up a different error.

09:26:09:229 VARIABLE_ASSIGNMENT [7]|httpRe|"System.HttpResponse[Status=OK, StatusCode=200]"|0x5eded4bb
**09:26:09:000 USER_DEBUG   <status>fail</status>**
09:26:09:000 USER_DEBUG     <items><item><code><![CDATA[-1]]></code><heading><![CDATA[Form Error]]></heading><description><![CDATA[No data received.]]></description><routine><![CDATA[]]></routine><icon><![CDATA[]]></icon><priority><![CDATA[]]></priority></item></items>

What I'm missing ?Any modification needed?

  • 5
    Your callout appears to have worked... – Adrian Larson Mar 28 '18 at 13:35

It's quite likely that the method is wrong. You wouldn't normally expect to see a body in a GET method. See:


[...] if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request.

And the definition of GET says that it is defined by the URI, not the body:


The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.

So it's probably ignoring your body. I think you should probably change it to


But whether or not that will work depends on the API you're contacting.

  • Actually, Salesforce converts a non-empty body callout to a post automatically. – sfdcfox Mar 28 '18 at 17:26

You are using the GET method.

Get Method should not have any body as per HTTP protocol suite. GET is used to retrive data, trying to provide data using GET will usually cause this error.

Your callout has worked, its the external server which does not support GET with body.

As @Adian Suggested you can try with POST, but in the end its not error related to SALESFORCE, you have to check the API docs of the third party you are integrating with.

SRC: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods

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.