0

I have a rest api for delete as RequestMethod.DELETE.

I have the @PathVariable("mediaId") String mediaId.

When I invoke the api with out a path paramert value as below, I get 405 Method Not Allowed.

http://localhost:8080/myservice/deleteme/mediaId/

The definition of 405 in wiki as below,

405 Method Not Allowed A request method is not supported for the requested resource; for example, a GET request on a form which requires data to be presented via POST, or a PUT request on a read-only resource.

Since i use the correct http method DELETE to invoke the delete api, why I am getting 405? In my opinion, 400 is more valid?

Harshana
  • 7,297
  • 25
  • 99
  • 173
  • _"Since i use the correct http method DELETE to invoke the delete api,"_ You wrote yourself that you don't invoke the "delete api": _"When I invoke the api with out a path paramer value as below"_ = not the "delete api" – a better oliver Jun 28 '16 at 10:49
  • @zeroflagL Shouldnt the missiong path parameter falls under with 400 Bad Request? What i meant was if i invoke this DELETE method with as POST method via postman, i can expect 405 according to the explanation. – Harshana Jun 28 '16 at 11:10
  • The path parameter is not missing. It's another URI alltogether. – a better oliver Jun 28 '16 at 11:13
  • i didnt get what you mean. the path parameter is there with emplty value – Harshana Jun 28 '16 at 12:14

0 Answers0