Catalyst Blockchain Manager API
For communication between your business application and a chaincode, Catalyst Blockchain Manager provides an API to invoke/query deployed chaincodes and subscribe for chaincode events.
Catalyst Blockchain Manager API can be used by users who have an on-premise installation. Users who use Catalyst Blockchain Manager as a BaaS will be able to use the API in future releases.
Catalyst Blockchain Manager supports two authorization types: Basic and OpenID. The authorization type is chosen during installation.
Invoke Endpoint
POST {domain}/api/v1/channels/{channelID}/cc/{chaincodeID}/invoke
Path Parameters
Domain*
String
The name of the domain where the Catalyst Blockchain Platform Fabric service is deployed
ChannelID*
String
The name of the channel where the chaincode is committed
ChaincodeID*
String
The chaincode name
Request Body
function*
String
The name of a chaincode function
args*
Array
An array of function arguments
transient_args
Object
Transient args — will reach the chaincode but won't stay in transaction records
is_init
Boolean
Indicates whether the init function call is required. Can only be true during the first operation with chaincode
Example:
{
"args": ["data"],
"transient_args": {
"asset_properties": {
"assetID": "99",
"objectType": "art",
"color": "black",
"size": 500,
"appraisedValue": 999
}
},
"function": "CreateAsset",
"is_init": false
}Response
200 OK:
{
"proposal_response": {
"chaincode_status": 0,
"payload": "",
"errors": [
{
"code": 0,
"message": "string"
}
]
},
"tx": {
"id": "string",
"validation_code": 0
}
}Response fields:
chaincode_status— Response from chaincode. Possible values:200(success) or500(failure)errors— Status error returned from a peer.messageequals the text in the exception the chaincode throwspayload— Data returned on successful invocation from chaincode in base64tx.id— Transaction ID (unique per request)tx.validation_code— Must be0for any valid transaction
Invoke example (Basic Auth):
Generate a Basic Auth token: echo {your_login}:{your_password} | base64
Query Endpoint
POST {domain}/api/v1/channels/{channelID}/cc/{chaincodeID}/query
Same path and body parameters as Invoke, with one addition:
use_local_peers
Boolean
Set to true to use only peers that belong to your organization
Query example (OpenID):
Subscribe Endpoint
Server-Sent Events (SSE) that allows your client to receive automatic updates from the server via HTTP for a specific chaincode.
GET {domain}/api/v1/channels/{channelID}/cc/{chaincodeID}/subscribe?startFrom={startFromValue}&eventFilter={eventFilterValue}
Query Parameters
startFrom
Integer
Block number (last block by default)
eventFilter
String
Regexp to filter only the needed events
Response
tx_id
The ID of the transaction in which the event was set
chaincode_id
The ID of the chaincode that set the event
event_name
The name of the chaincode event
payload
The payload of the chaincode event in base64
block_number
The block number in which the chaincode event was committed
Subscribe example (OpenID):
Last updated
Was this helpful?