I have the following JSON
, which I have validated using JsonLint :
{
"names": [
{
"id":"123",
"name":"stubName",
"type":"stubType",
}
]
}
I would like to add it as a message body in my CURL
command (using Cygwin
) in order to test a REST handler that I wrote.
I am currently using this command, which I created from reading this answer:
curl -H "Content-Type: application/json" -X PUT -d '{
"names": [
{
"id":"123",
"name":"StubName",
"type":"StubType",
}
]
}' localhost:9980/Id/123/version/123/addPerson
My handler is as follows:
@PUT
@Consumes("application/json")
@Path("/Id/{Id}/version/{version}/addPerson")
public Response addPerson(@PathParam("Id") String Id,
@PathParam("version") String version,
@Context List<Name> names) {
LOGGER.info("NAMES PASSED : {}", names.toString());
}
When I try to hit my method using CURL I get an HTTP 400
method.
Edit: when I try to do names.toString() I get a null pointer, meaning that the names list must be null.