Post book
https://melanieoneboxfunctionsprint3.azurewebsites.net/v1/books
With the following request:
{ "title": "Test", "description": "TEST", "cover_image": "https://myimage", "author": "TEST" }
Got a response of the bookId returned:
bc9e0b1c-d51e-4bcb-a569-2efa122c3a38
PUT /book
https://melanieoneboxfunctionsprint3.azurewebsites.net/v1/books/bc9e0b1c-d51e-4bcb-a569-2efa122c3a38
With the following request:
{ "id":"changeID", "title": "Test", "description": "TEST", "cover_image": "https://myimage", "author": "TEST" }
Got a response of the following book object:
{
"id": "changeID",
"description": "TEST",
"author": "TEST",
"cover_image": "https://myimage",
"title": "Test",
"pages": null
}
Just an opinion: When updating the book, it's better to only update all fields other than id. Reason is the user can use the existing id and we may have duplicated IDs.
Steps to Repro:
Post book
https://melanieoneboxfunctionsprint3.azurewebsites.net/v1/books
With the following request:{ "title": "Test", "description": "TEST", "cover_image": "https://myimage", "author": "TEST" }
Got a response of the bookId returned:
bc9e0b1c-d51e-4bcb-a569-2efa122c3a38
PUT /book
https://melanieoneboxfunctionsprint3.azurewebsites.net/v1/books/bc9e0b1c-d51e-4bcb-a569-2efa122c3a38
With the following request: { "id":"changeID", "title": "Test", "description": "TEST", "cover_image": "https://myimage", "author": "TEST" }Got a response of the following book object: { "id": "changeID", "description": "TEST", "author": "TEST", "cover_image": "https://myimage", "title": "Test", "pages": null }
Just an opinion: When updating the book, it's better to only update all fields other than id. Reason is the user can use the existing id and we may have duplicated IDs.