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

Querying Peers

Function

Querying Peers

URI

GET /v2/agent/apis/peers

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

peers

Map<String,PeerInfo>

The key is the peer domain name, and value is the peer details.

Table 3 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 4 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/peers

Example Responses

Status code: 200

Success

{
  "peers" : {
    "peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5-0.peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5.default.svc.cluster.local" : {
      "org_name" : "organization",
      "org_id" : "a9e940a9e947e8af0c9c2fb98d0129e56210d6b5",
      "peer" : "peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5-0.peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5.default.svc.cluster.local",
      "peer_name" : "peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5-0",
      "url" : "100.95.146.117:30610",
      "channels" : [ "channel" ],
      "status" : "running"
    },
    "peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5-1.peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5.default.svc.cluster.local" : {
      "org_name" : "organization",
      "org_id" : "a9e940a9e947e8af0c9c2fb98d0129e56210d6b5",
      "peer" : "peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5-1.peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5.default.svc.cluster.local",
      "peer_name" : "peer-a9e940a9e947e8af0c9c2fb98d0129e56210d6b5-1",
      "url" : "100.95.146.117:30611",
      "channels" : [ "channel" ],
      "status" : "running"
    }
  }
}

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.