Designing an API

Before building our application, we must design a service API to cover the capabilities exposed by our middleware. We will design our API to be RESTful, as follows:

  1. POST/login: Register a new user (administrative or ordinary) or log in as an existing one
  2. POST/channel/create: Create a channel

 

  1. POST/channel/join: Join the network peers to the channel created in this user's session
  2. POST/chaincode/install: Install the chaincode on the peers
  3. POST/chaincode/instantiate: Instantiate the chaincode on the channel
  4. POST/chaincode/:fcn: Invoke the chaincode function fcn with passed arguments (in the body); examples for fcn are requestTrade, acceptLC, and so on
  5. GET/chaincode/:fcn: Query the chaincode function fcn with passed arguments (in the body); examples for fcn are getTradeStatus, getLCStatus, and so on

Collectively, these API functions cover the transaction stages in Figure 5.3: The stages in the creation and operation of a blockchain application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.165.86