library-rpc

Create a new book.

RPCbooks.create

Creates a book in "available" status and links it to its author. The server assigns the "id", "createdAt" and "updatedAt" fields.

Servers

•mock: https://mock.api.selfdochub.com/rpc

Parameters

NameInTypeRequiredDescription
titleparamsstringyesThe book's display title, 1-200 characters.
isbnparamsstringyesThe book's ISBN. Must be unique across the catalog.
authorIdparamsstringyesThe id of an existing Author who wrote this book.
publishedYearparamsintegeryesThe year the book was first published. Must be between 1450 and next year.

Responses

result The book that was created.

application/json

FieldTypeRequiredDescription
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.

Errors

CodeMessageDescription
-32602Invalid params
-32004Not found
-32001Conflict

Request example

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "books.create",
  "params": {
    "authorId": "authorId_2",
    "isbn": "isbn_704",
    "publishedYear": 106,
    "title": "title_403"
  }
}

Response example

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "authorId": "authorId_722",
    "createdAt": "createdAt_391",
    "id": "id_431",
    "isbn": "isbn_255",
    "publishedYear": 84,
    "status": "borrowed",
    "title": "title_355",
    "updatedAt": "updatedAt_971"
  }
}