Message body with GET request throw exception?

Topics: Web Api
May 9, 2012 at 2:32 PM

Am I correct that the Web API is throwing an exception when I attempt to pass a message body with a GET request?  Strictly speaking, this is not forbidden by the HTTP spec so I am surprised the API would block it.

I have many methods in my API that accept complex data used to identify the resources to return from the method.  I am not changing the state of the server, so POST is not the appropriate verb. Since this is a retrieval operation, GET is the correct one.

Am I misconstruing what I'm seeing when I attempt to pass data in the body of the GET message or is something else blocking me?


May 9, 2012 at 3:07 PM

It is never correct to include a request entity body in a GET request -- GET is stricly defined in terms of "HTTP language" which means header fields and not in terms of a body. In other words, a request body in a GET request is semantically meaningless and so a sender should not send it.

Hope this helps,