Livingst0n / pocketjobcoach

1 stars 1 forks source link

Web API's PUT and DELETE return 405 #5

Closed higgsch closed 8 years ago

higgsch commented 8 years ago

PUT and DELETE aren't working. 405 error means that the command isn't supported. Research points towards the inclusion of WebDAV and/or PUT/DELETE not being included in the verb list. But neither nor both of these modifications resolve the issue.

Temporarily using: < Table > GET as GET < Table > GET(id) as GET(id) < Table > POST(< record >) as POST(< record >) Delete< Table > GET(id) as DELETE(id) Delete< Table > POST(< record >) as PUT(< record >)

higgsch commented 8 years ago

PUT and DELETE have industry known issues. Confirmed by Prof. Rob Hilton that using duplicate GET and POST function as DELETE and PUT is industry accepted workaround. Now we need to decide how we are going to model them.

  1. Using a separate controller,
  2. Passing in a delimiter for overload, or
  3. Routing duplicate calls through the same controller.
higgsch commented 8 years ago

Okay, so I have routed the Http table as follows using an example of a Hello table:

To GET: GET -> api/Hello [This means to send a GET request to the url pjc.gear.host/api/Hello] To GET by id (ex. 5): GET -> api/Hello/5 To POST: POST -> api/Hello To PUT: POST -> api/Hello?put=true To DELETE by id (ex. 5): GET -> api/Hello/5?delete=true

Next I'll be looking at how this will work with token authentication

higgsch commented 8 years ago

Following breaks down how to link into the Web API: To GET: GET -> api/ [This means to send a GET request to the url pjc.gear.host/api/Hello for the Hello controller] To GET by id (ex. 5): GET -> api//5 To POST: POST -> api/ To PUT: POST -> api/?put=true To DELETE by id (ex. 5): GET -> api//5?delete=true

When a token is required: To GET: GET -> api/?token= To GET by id (ex. 5): GET -> api//5?token= To POST: POST -> api/?token= To PUT: POST -> api/?put=true&token= To DELETE by id (ex. 5): GET -> api//5?delete=true&token=