You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

  1. Org
    1. POST api/v1/organizations/     #create organization,just for MSP and tls
    2. POST api/v1/nodes/     #create orderer, peer, just for MSP and tls.
    3. POST api/v1/users/   #create user, bind current user.

  2. Agent
    1. POST api/v1/agents/   #create agent and connect to the resource; bind to organization.
  3. Network
    1. POST api/v1/networks  #create network
  4. Nodes
    1. POST api/v1/nodes/{id}/operations/    #start, stop, restart a node.

  5. Channel
    1. POST api/v1/channels #create channel
  6. Chaincode
    1. POST api/v1/chaincode #upload the chaincode
    2. POST api/v1/chaincode{id}/operations/   #intall, instanitate the chaincode.

2.1 Agent

KeyValueNote
idUUIDAgent id
namestringAgent name
urlsstringAgent url
create_atdateCreation time of network
typestringAgent type
organizationOrganizationThe organization to which the agent belongs
statusstringAgent status
freeportsarrayAgent free ports

2.2 Network

KeyValueNote
idUUIDNetwork id
namestringNetwork name
typestringNetwork type
versionstringFabric version
created_atdateCreation time of network
consensusstring Type of network consensus
genesisblockstringGenesis block
databasestringDatabase of network

2.3 Node

KeyValueNote
idUUIDNode id
namestringNode name
typestring Node type
urlsstringNode urls
userUserThe user of the node
organizationOrganizationThe ID of the organization to which the node belongs
agent AgentThe ID of the agent to which the node belongs

status

string

The status of the node

config_filestringConfig file of node
mapstringNode's map zip file
tlsstringNode's tls zip file
cidstringDocker container id

2.4 Organization

KeyValueNote
idUUIDOrganization id
namestringName of organization
networkNetworkThe ID of the network to which the organization belongs
agentsAgentThe ID of the agent to which the organization belongs
created_atdateCreation time of organization
mspstringOrganization's msp zip file
tlsstringOrganization's tls zip file

2.5 UserProfile

KeyValueNote
idUUIDUserProfile ID
emailstringUser's email
usernamestringUser's username
rolestringUser's role
organizationOrganizationUser's organization

2.6 Channel

KeyValueNote
idUUIDChannel Id
namestringChannel Name
organizationsOrganizationChannel Organizations
create_tsdateCreation time of channel
networkNetworkThe ID of network
orderersOrderersOrderers in the Channel

2.7 Chaincode

KeyValueNote
idUUIDChaincode Id
namestringChaincode name
versionstringChaincode version
creatorstringChaincode creator
languagestringProgramming language of Chaincode
mdtstringChaincode md5
create_tsdateCreation 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"
}



  • No labels