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

Querying Version of a Specified Chaincode

Function

Querying Version of a Specified Chaincode

URI

GET /v2/agent/apis/chaincode/versions

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

versions

Array of ChaincodeVersion objects

Chaincode version information.

Table 4 ChaincodeVersion

Parameter

Type

Description

version

String

Chaincode version.

hash_code

String

Hash value of the chaincode version.

description

String

Chaincode version description.

install_time

String

Chaincode version installation time.

update_time

String

Chaincode version update time.

instantiate_status

Boolean

Chaincode version instantiation status.

security_check_status

Integer

Chaincode security check status. The options are as follows: 0: The check does not exist; 1: The check is running; 2: The check is completed; 3: The check failed.

uninstantiated_peer_infos

Array of PeerInfo objects

Peers where the chaincode is not instantiated.

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.

Status code: 400

Table 6 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/versions?chaincode_name=chaincode

Example Responses

Status code: 200

Success

{
  "versions" : [ {
    "version" : "1.0",
    "hash_code" : "1473b4807fe9f970d1ba56192e41d39c7d621d07d80e603cf75ed3982b81034d",
    "description" : "",
    "install_time" : "2021-01-11T11:27:12.093454567+08:00",
    "update_time" : "2021-01-11T11:27:12.093454789+08:00",
    "instantiate_status" : false,
    "uninstantiated_peer_infos" : [ {
      "org_name" : "organization",
      "org_id" : "57e7914450b098771f5106acaf02be8a61894fae",
      "peer_name" : "peer-0",
      "peer_id" : "peer-57e7914450b098771f5106acaf02be8a61894fae-0.peer-57e7914450b098771f5106acaf02be8a61894fae.default.svc.cluster.local"
    }, {
      "org_name" : "organization",
      "org_id" : "57e7914450b098771f5106acaf02be8a61894fae",
      "peer_name" : "peer-1",
      "peer_id" : "peer-57e7914450b098771f5106acaf02be8a61894fae-1.peer-57e7914450b098771f5106acaf02be8a61894fae.default.svc.cluster.local"
    } ],
    "security_check_status" : 2
  } ]
}

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.