library-rest

Full-text search over book titles and ISBNs.

GET/books/search

Returns books whose title or ISBN contains q (case-insensitive). An empty or missing q returns no results. Unlike GET /books, this endpoint is not paginated and has no other filters — it is meant for quick free-text lookups such as a search box.

Parameters

NameInTypeRequiredDescription
qquerystringFree-text search term matched against title and ISBN.

Responses

200 Books matching the search term (possibly empty).

application/json

FieldTypeRequiredDescription
dataarray of objectyes
authorIdstringyesThe id of the Author who wrote this book.
createdAtstring (date-time)yesWhen the book record was created.
idstringyesUnique identifier assigned by the server, prefixed with bk_.
isbnstringyesThe book's ISBN. Must be unique across the catalog.
publishedYearintegeryesThe year the book was first published. Must be between 1450 and next year.
statusstringyesA book's availability. borrowed means it is out on an open loan. Allowed values: available, borrowed
titlestringyesThe book's display title, 1–200 characters.
updatedAtstring (date-time)yesWhen the book record was last modified.
metaobjectyesResponse metadata attached to every successful response.
requestIdstringyesCorrelation id for this request, echoed from the X-Request-Id request header or generated if absent. Useful for tracing a request across logs.
totalintegerTotal number of matches before pagination was applied. Present only on paginated list responses (currently GET /books).

Errors

CodeMessageDescription
401The request is missing a valid Authorization: Bearer <token> header.
500An unexpected error occurred. The response never leaks internal error details.

Response example

{
  "data": [
    {
      "authorId": "authorId_985",
      "createdAt": "createdAt_435",
      "id": "id_669",
      "isbn": "isbn_529",
      "publishedYear": 835,
      "status": "available",
      "title": "title_283",
      "updatedAt": "updatedAt_938"
    }
  ],
  "meta": {
    "requestId": "requestId_512",
    "total": 101
  }
}