Search code examples
postrestletputrestsharp

415 error while trying to POST or PUT to a RESTLET service


I'm using Restlet v2.1.2 to build a Java based REST service. Everything has been working flawlessly BUT no I've run into problems while trying to PUT/POST to the service using a .Net client, which in turn uses RestSharp to talk to the service. As I mentioned various GET/PU/POST/DELETE request have all worked flawlessly but now when I try to send a "large" request I've run into problems.

I have a URI looking something like: "http://:/matches"

What I'd like to do is to provide two URI parameters {index} and {base64encoded} but as the {base64encoded} may get veeeeeery large, I unfortunately have to rely on PUT/POST in order to use the request.AddBody() method and there provide an object containing those parameters. Furthermore I set request.RequestFormat = DataFormat.Json; but when I execute the request I get either a http 405 or 415 error.

What am I doing wrong here???


Solution

  • I'm so sorry! I had simply overseen the fact that I had forgot to provide the "...foo(JsonRepresentation bar)" parameter declaration for the Get method!!! After adding this parameter it works like a charm:) Thanks for your reply though...:)