The current version of the API returns a single, hardcoded book record for all GET requests sent to the /Books endpoint. This should be altered, such that the /Books endpoint takes an ID for the book to return.
High-Level Proposed Solution
Alter the Get method of the BooksController to take a GUID
The supplied GUID value should be used in the service which implements the IGetBook interface
The book record which matches against the supplied Id is returned to the Get method
If no matching record is found, the Get method returns a 404
If a matching record is found, the Get method returns a 200 with the book in the body
Considerations
The SwaggerResponse attributes on the Get API endpoint may need to be updated. This will allow Swagger to provide documentation on the request and response types.
The FlatFilebookService may need to be replaced with one which contains a private collection of Book records, with the GetBook method returning only the matching record.
Remember that we haven't decided on a data storage technology or technique yet. So we don't need to implement a data repository.
Requirements
The Get API endpoint should return a Book record which matches a supplied ID
If the request to the Get API endpoint does not contain a valid GUID, a 403 is returned
Description
The current version of the API returns a single, hardcoded book record for all
GET
requests sent to the/Books
endpoint. This should be altered, such that the/Books
endpoint takes an ID for the book to return.High-Level Proposed Solution
Get
method of theBooksController
to take a GUIDIGetBook
interfaceGet
methodGet
method returns a 404Get
method returns a 200 with the book in the bodyConsiderations
The
SwaggerResponse
attributes on theGet
API endpoint may need to be updated. This will allow Swagger to provide documentation on the request and response types.The
FlatFilebookService
may need to be replaced with one which contains a private collection ofBook
records, with theGetBook
method returning only the matching record.Remember that we haven't decided on a data storage technology or technique yet. So we don't need to implement a data repository.
Requirements
Get
API endpoint should return a Book record which matches a supplied IDGet
API endpoint does not contain a valid GUID, a 403 is returned