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

Listing Installed Chaincodes

Function

This API is used to list installed chaincodes.

URI

GET /v2/agent/apis/chaincodes

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Offset to start querying the chaincode list. The default value is 0.

limit

No

Integer

Number of listed chaincodes. The default value is 10.

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

count

Integer

Total number of chaincodes.

chaincodes

Array of ChaincodeInfo objects

Chaincodes.

Table 4 ChaincodeInfo

Parameter

Type

Description

chaincode_name

String

Chaincode name.

chaincode_language

String

Chaincode programming language.

update_time

String

Chaincode update time.

chaincode_version

String

Chaincode version. Separate multiple chaincode versions with commas (,).

install_org_infos

Array of PeerInfo objects

Chaincode installation information.

instantiated_channel

instantiated_channel object

Chaincode channel information.

instantiated_info

instantiated_info object

Instantiation information.

Table 5 PeerInfo

Parameter

Type

Description

org_name

String

Organization name.

org_id

String

Organization ID.

peer_name

String

Peer name.

peer_id

String

Peer ID.

status

String

Peer status.

channels

Array of strings

Peers where the chaincode is not instantiated.

url

String

URL of the peer.

peer

String

Internal domain name of the peer.

Table 6 instantiated_channel

Parameter

Type

Description

error

Array of CCInstantiatedChannelError objects

Instantiation error information.

success

Array of strings

Channels where the instantiation succeeded.

inprogress

Array of strings

Instantiation progress.

Table 7 CCInstantiatedChannelError

Parameter

Type

Description

channel_name

String

Name of the channel where the error occurred.

error_detail

String

Error details.

Table 8 instantiated_info

Parameter

Type

Description

channels

Array of channels objects

Channel information.

Table 9 channels

Parameter

Type

Description

channel_id

String

Channel name.

orgs

Array of orgs objects

Channel organization information.

versions

Array of strings

Version.

Table 10 orgs

Parameter

Type

Description

org_name

String

Organization name.

org_id

String

Organization ID.

Status code: 400

Table 11 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/chaincodes

Example Responses

Status code: 200

Success

{
  "count" : 12,
  "chaincodes" : [ {
    "chaincode_name" : "test001",
    "chaincode_version" : "1.0",
    "update_time" : "2021-01-12T11:32:04.193358708+08:00",
    "instantiated_info" : {
      "channels" : [ {
        "channel_id" : "channel",
        "versions" : [ "1.0" ]
      }, {
        "channel_id" : "testchannel",
        "orgs" : null,
        "versions" : [ "1.0" ]
      } ]
    },
    "chaincode_language" : "golang"
  } ]
}

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.