Creating/updating/deleting records through JSON-RPC
In the previous recipe, we looked at how to search and read data through JSON-RPC. In this recipe, we will perform the remaining CRUD operations through RPC—Create, Update (write), and Delete (unlink).
Getting ready
We will create a Python program to create
, write
, and unlink
data in the library.book
model. Make sure you have installed the my_library
module and that the server is running on http://localhost:8069
.
How to do it...
Perform the following steps to create, write, and unlink a book's information through RPC:
- Add the
jsonrpc_operation.py
file. You can place this file anywhere you want because the RPC program will work independently. - Add the following code to the file:
# place authentication and get_json_payload method (see last recipe for more) if user_id:     # creates the books records     create_data = [        ...