January 23, 2013

Status=Length Required, StatusCode=411 error in Apex callout

Content-Length should be mentioned to avoid this error in callouts.

Sample Code:

  1. HttpRequest request = new HttpRequest();  
  2. request.setHeader('Content-Length''512');  

Use GET method instead of POST method. So that, Content-Length is not required. If you use POST method, Content-Length is required.

1 comment: