Reputation: 13
I am working on Restful Web Services which give JSON response and i got following output when there is no data for entered id=11
GET Request Failed Request Failed --> Status: (204) Response: {
}
Now I want That response field contain proper message for error code=204 like "invalid request" or "id doesn't exist"
Upvotes: 1
Views: 953
Reputation: 15758
If you are using Jersey or similar JAX-RS framework you can modify your code similar to :
return Response.status(204).type("text/plain")
.entity("Invalid Request!").build();
Upvotes: 1