Create an API that searches books where either the title contains the given keyword, or the author's name contains the given keyword. This search should use route data for the keyword. See Figure 2.
Users can search by one or both criteria. If a criterion is not relevant (i.e., not part of the search), the user should use the keyword "*" to indicate that it should be skipped.
URL: [GET]/api/books/search/{title}/{author}
Example 1: GET /api/books/search/OData/Doe/*
(search for books where the title contains "Odata" and author's name contains "Doe")
Example 2: GET/api/books/search/OData/*
(search by title only, search for books where the title contains "OData")
Example 3: GET/api/books/search/*/Doe
(search by author only, search for books where the author's name contains "Doe")
http://localhost:5000/api/Books/search/harry/%2A
Server response
Code
Details
200
Response body
[
"bookId": 2,
"title": "Harry Potter and the Philosopher's Stone",
"authors": [
{ "authorId": 2,
"name": "J.K. Rowling",
"bio": "British author, best known for the Harry Potter series."
"authorId": 3,
"name": "3.R.R. Tolkien",
Zoom
+ 100%
"bio": "English writer, poet, philologist, and academic."
Close