library-rpc
List books with optional filtering and pagination.
RPC
books.listReturns books matching the given filters, ordered by id, together with the total number of matches (before pagination is applied) in the result's "total" field. All parameters are optional and combine with logical AND; omitting every parameter returns the full catalog, one page at a time.
Servers
•
mock: https://mock.api.selfdochub.com/rpcParameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| authorId | params | string | Restrict results to books written by this author. | |
| status | params | string | Restrict results to books in this availability status. A book's availability. "borrowed" means it is out on an open loan. Allowed values: available, borrowed | |
| query | params | string | Case-insensitive substring match against the book title. | |
| offset | params | integer | Number of matching books to skip, for pagination. Must not be negative. | |
| limit | params | integer | Maximum number of books to return. Omit or use 0 to return every remaining match after offset. Must not be negative. |
Responses
result The page of books matching the filter.
application/json
| Field | Type | Required | Description |
|---|---|---|---|
| books | array of object | yes | |
| authorId | string | yes | The id of the Author who wrote this book. |
| createdAt | string (date-time) | yes | When the book record was created. |
| id | string | yes | Unique identifier assigned by the server, prefixed with bk_. |
| isbn | string | yes | The book's ISBN. Must be unique across the catalog. |
| publishedYear | integer | yes | The year the book was first published. Must be between 1450 and next year. |
| status | string | yes | A book's availability. "borrowed" means it is out on an open loan. Allowed values: available, borrowed |
| title | string | yes | The book's display title, 1-200 characters. |
| updatedAt | string (date-time) | yes | When the book record was last modified. |
| total | integer | yes | Total number of matches before offset/limit was applied. |
Errors
| Code | Message | Description |
|---|---|---|
| -32602 | Invalid params |
Request example
{
"id": 1,
"jsonrpc": "2.0",
"method": "books.list",
"params": {
"authorId": "authorId_352",
"limit": 71,
"offset": 826,
"query": "query_203",
"status": "available"
}
}Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"books": [
{
"authorId": "authorId_882",
"createdAt": "createdAt_896",
"id": "id_891",
"isbn": "isbn_574",
"publishedYear": 449,
"status": "borrowed",
"title": "title_379",
"updatedAt": "updatedAt_716"
}
],
"total": 476
}
}