documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Fix PUT Endpoint to Follow RESTful Standards and Resolve 405 Method Not Allowed Error

Open moko-poi opened this issue 1 year ago • 3 comments

What does this PR do? What is the motivation?

This PR fixes the PUT endpoint in the Notes API by updating it to follow RESTful standards. The previous implementation caused a 405 Method Not Allowed error. This change moves the resource ID to the URI path, which resolves the error and aligns the API with RESTful design principles.

Merge instructions

Please merge after reviewing the updated endpoint and confirming the fix.

Additional notes

Before the change, the PUT request returned a 405 error. After the update, it now returns a 200 success response with the updated note.

Before: Request: curl -X PUT 'BASE_DOMAIN:8080/notes?id=1&desc=UpdatedNote'

Response: 405 Method Not Allowed

After: Request: curl -X PUT 'BASE_DOMAIN:8080/notes/1?desc=UpdatedNote'

Response:

{"id":"1","description":"UpdatedNote"}
200 OK

moko-poi avatar Oct 18 '24 16:10 moko-poi