Updated on 2023-04-26 GMT+08:00

Downloading the SDK Configuration

Function

This API is used to download the SDK configuration file of a specified BCS service.

URI

POST /v2/{project_id}/blockchains/{blockchain_id}/sdk-cfg

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID obtained from IAM. Generally, a project ID contains 32 characters.

blockchain_id

Yes

String

blockchainID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Minimum: 1

Maximum: 32768

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

chaincode_name

Yes

String

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

cert_path

Yes

String

Directory for storing the SDK configuration file.

channel_name

Yes

String

Channel name.

peer_orgs

Yes

Map<String,Array<String>>

The key is the organization name and the value is the information of peers whose certificates are to be downloaded. Specify peers in ascending order, for example, 0, 1, and 2.

union_info

No

Map<String,Array<String>>

The key is the name of a consortium member and the value is the hash value array of the peer organization names of the member.

is_multi_chan

No

Boolean

Indicates whether the request is a multi-channel request. If this parameter is set to true, configure channel_chaincode, and leave chaincode_name and channel_name empty.

channel_chaincode

No

Map<String,Array<String>>

The key is the channel name and the value is the chaincode array corresponding to the channel.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

-

File

Ok

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 36

error_msg

String

Error message.

Minimum: 2

Maximum: 512

Example Requests

{
  "chaincode_name" : "chaincode",
  "cert_path" : "/root",
  "channel_name" : "channel",
  "peer_orgs" : {
    "organization" : [ "peer-328000cb35d8971e0b0388f6182f95eaa4100784-0.peer-328000cb35d8971e0b0388f6182f95eaa4100784.default.svc.cluster.local", "peer-328000cb35d8971e0b0388f6182f95eaa4100784-1.peer-328000cb35d8971e0b0388f6182f95eaa4100784.default.svc.cluster.local" ]
  }
}

Example Responses

Status code: 200

Ok

{
  "result" : "success"
}

Status code: 400

Bad Request

{
  "error_code" : "BCS.4006005",
  "error_msg" : "keyType error, keyType: blok not supported"
}

Status code: 401

Unauthorized

{
  "error_code" : "BCS.4010401",
  "error_msg" : "Incorrect token or token resolution failed"
}

Status code: 403

Forbidden

{
  "error_code" : "BCS.4030403",
  "error_msg" : "No permissions to request this method"
}

Status code: 404

Not Found

{
  "error_code" : "BCS.4040404",
  "error_msg" : "Not Found:the url is not found"
}

Status code: 500

InternalServerError

{
  "error_code" : "BCS.5000500",
  "error_msg" : "Internal Server Error"
}

Status Codes

Status Code

Description

200

Ok

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

InternalServerError

Error Codes

See Error Codes.