Reputation: 325
I'm trying to create an HTTP endpoint to delete a property but I'd like to add some additional metadata about who is performing the delete. I have the following server side code in Jersey.
@DELETE
@Path("/properties/{property_id}?deleted_by={deleted_by}")
public Response deleteProperty(
@PathParam("property_id") int propertyId,
@QueryParam("deleted_by") String deletedBy)
{
...
}
However when I try to hit the endpoint with a url like /properties/123?deleted_by=test
I get a 404. If I delete the query parameter everything works as intended. Does Jersey not support query parameters for DELETE
or am I messing something up?
Upvotes: 0
Views: 2321
Reputation: 19615
You don't have to mention the query parameter in the path annotation. Just the following should be fine:
@DELETE
@Path("/properties/{property_id}")
public Response deleteProperty(
@PathParam("property_id") int propertyId,
@QueryParam("deleted_by") String deletedBy)
{
...
}
The Jersey documentation has an additional example.
Upvotes: 4