Can we have a JSON object as an input parameter for http access to RESTful web services?

I am new to RESTful web services. Can I have a method like below that accepts JSON as an object?

@GET
   @Produces("application/json")
   @Consumes("application/json")
   @Path("/test")
   public Response modifyJson(JSONObject input);
+3
source share
1 answer

I believe that by default it is not possible to send Json as an input to GET, only other verbs (POST, PUT ...)

Having said that, technically it depends on a service that allows you to or not send input to GET. It is common to send query string parameters using GET.

Hope this helps

Ademar

+2
source

All Articles