This spec describes the API that the API Agents should provide. A Cello API-Engine should be responsible for the node management by interacting with the resource manager like Docker or Kubernetes.
1. Rules to follow
- All APIs by default start with a prefix of /api/v1/, e.g., to get the information of a specific network, you can use GET network/<network-uuid>.
- The POST request is a JSON structure, like the following: { key: value, }
The response is a JSON structure, like the following:
{ status: ‘successful’ or ‘fail’ data: {} // useful data for the requestor msg: ‘’ // additional messages when there’s error }
2. Model
- Org
- POST api/v1/organizations/ #create organization,just for MSP and tls
- POST api/v1/nodes/ #create orderer, peer, just for MSP and tls.
POST api/v1/users/ #create user, bind current user.
- Agent
- POST api/v1/agents/ #create agent and connect to the resource; bind to organization.
- Network
- POST api/v1/networks #create network
- Nodes
POST api/v1/nodes/{id}/operations/ #start, stop, restart a node.
- Channel
- POST api/v1/channels #create channel
- Chaincode
- POST api/v1/chaincode #upload the chaincode
- POST api/v1/chaincode{id}/operations/ #intall, instanitate the chaincode.
2.1 Agent
Key | Value | Note |
---|---|---|
id | UUID | Agent id |
name | string | Agent name |
urls | string | Agent url |
create_at | date | Creation time of network |
type | string | Agent type |
organization | Organization | The organization to which the agent belongs |
status | string | Agent status |
freeports | array | Agent free ports |
2.2 Network
Key | Value | Note |
---|---|---|
id | UUID | Network id |
name | string | Network name |
type | string | Network type |
version | string | Fabric version |
created_at | date | Creation time of network |
consensus | string | Type of network consensus |
genesisblock | string | Genesis block |
database | string | Database of network |
2.3 Node
Key | Value | Note |
---|---|---|
id | UUID | Node id |
name | string | Node name |
type | string | Node type |
urls | string | Node urls |
user | User | The user of the node |
organization | Organization | The ID of the organization to which the node belongs |
agent | Agent | The ID of the agent to which the node belongs |
status | string | The status of the node |
config_file | string | Config file of node |
map | string | Node's map zip file |
tls | string | Node's tls zip file |
cid | string | Docker container id |
2.4 Organization
Key | Value | Note |
---|---|---|
id | UUID | Organization id |
name | string | Name of organization |
network | Network | The ID of the network to which the organization belongs |
agents | Agent | The ID of the agent to which the organization belongs |
created_at | date | Creation time of organization |
msp | string | Organization's msp zip file |
tls | string | Organization's tls zip file |
2.5 UserProfile
Key | Value | Note |
---|---|---|
id | UUID | UserProfile ID |
string | User's email | |
username | string | User's username |
role | string | User's role |
organization | Organization | User's organization |
2.6 Channel
Key | Value | Note |
---|---|---|
id | UUID | Channel Id |
name | string | Channel Name |
organizations | Organization | Channel Organizations |
create_ts | date | Creation time of channel |
network | Network | The ID of network |
orderers | Orderers | Orderers in the Channel |
2.7 Chaincode
Key | Value | Note |
---|---|---|
id | UUID | Chaincode Id |
name | string | Chaincode name |
version | string | Chaincode version |
creator | string | Chaincode creator |
language | string | Programming language of Chaincode |
mdt | string | Chaincode md5 |
create_ts | date | Creation time of Chaincode |
3. Routes
3.1 Register organization and user
POST api/v1/register/ #register organization and user(admin)
Example:
Request Body:
{ "username": "test", "role": "administrator", "password": "foo", "passwordAgain": "foo", "orgName": "org1.cello.com", "email": "foo@email.com" }
Response Body:
{ "data": { "id": "0b245629-06cf-4fa5-92d9-7109a3a64b56" }, "msg": null, "status": "successful" }