1
I’m creating a Web Service, but I’m having a lot of doubts about how to receive JSON as a parameter.
@Path("WebService/{json}")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String POST (@PathParam("json") String json)
{
return json ;
}
In this code I’m getting the JSON in the URL this way:
http://localhost:8080/IC/webresources/WebService/[ { "name": "SAM", "id": 1 }, { "name": "DEAN", "id": 2 } ]
That is, there is a JSON in the URL.
That’s the only way I’ve found so far. Someone can give me a light?
Thank you, Victor! Do you have any example of request? Excuse is that it is my first time doing a Web Service.
– Lucas Angeli Gimenes