0

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?

1
  • Make sure on the client side you are sending an http Delete request Commented May 31, 2016 at 15:25

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Removing the query parameter from the path worked. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.