Updated on 2023-10-09 GMT+08:00

Querying Chaincode Instantiation Information

Function

This API is used to query the information about chaincode instantiation on a channel.

URI

GET /v2/agent/apis/chaincode/instantiate

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

chaincode_name

Yes

String

Chaincode name, which can contain 6 to 25 including lowercase letters and digits, and must start with a letter.

Minimum: 6

Maximum: 25

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

result

Array of ChannelInstantiateInfo objects

Information about chaincode instantiation on a channel.

Table 4 ChannelInstantiateInfo

Parameter

Type

Description

channel_name

String

Channel name.

instantiate_info

InstantiateInfo object

Instantiation information.

endorsement_policy

String

Endorsement policy.

version

String

Chaincode version.

orgs_info

Array of OrgInfo objects

Channel organization information.

has_private_data

Integer

Indication of whether privacy data exists. 1: Privacy data exists; 0: Privacy data does not exist.

Table 5 InstantiateInfo

Parameter

Type

Description

status

String

Instantiation status, which can be CHAINCODE_INSTANTIATED, CHAINCODE_INSTANTIATION_INPROGRESS, and CHAINCODE_INSTANTIATION_FAILED.

code

String

Code of the instantiation result.

reason

String

Cause of the instantiation result.

detail

String

Details of the instantiation result.

Table 6 OrgInfo

Parameter

Type

Description

org_name

String

Organization name.

org_id

String

Organization ID.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error description.

error_msg

String

Error description.

Example Requests

GET https://192.168.0.90:30603/v2/agent/apis/chaincode/instantiate?chaincode_name=chaincode

Example Responses

Status code: 200

Success

{
  "result" : [ {
    "channel_name" : "channel",
    "instantiate_info" : {
      "status" : "CHAINCODE_INSTANTIATED",
      "code" : "1000",
      "reason" : "1000",
      "detail" : ""
    },
    "endorsement_policy" : "OR,org1,org2",
    "version" : "2.0",
    "orgs_info" : [ {
      "org_name" : "org1",
      "org_id" : "65cfb1c760f24058c865ffcfd8ce1cdb690bf2a3"
    }, {
      "org_name" : "org2",
      "org_id" : "a48c4ed995238eceaee3fe738f1871b2e58db350"
    } ],
    "has_private_data" : 0
  } ]
}

Status code: 400

Bad Request

{
  "error_code" : "BCS.4000013",
  "error_message" : "request body is too large"
}

Status Codes

Status Code

Description

200

Success

400

Bad Request

Error Codes

See Error Codes.