You can call this operation to upgrade the chaincode.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes UpgradeFabricChaincode

The operation that you want to perform. Set the value to UpgradeFabricChaincode.

ChaincodeId String Yes code-sacc-fk9z4r97****

The ID of the chaincode.

OrganizationId DO NOT TRANSLATE Yes Peers-wholesaler-15ix77tof ****

The ID of the organization.

CollectionConfig String No [{"requiredPeerCount":0,"name":"collectionName","maxPeerCount":3,"blockToLive":0,"policy":"OR('Org1MSP.peer')"}]

The configurations of the private dataset.

EndorsePolicy String No OR ("wholesalerMSP.peer")

The endorsement policy.

Location String No cn-hangzhou

The location.

RegionId String No cn-hangzhou

The ID of the region.

Response parameters

Parameter Type Example Description
ErrorCode Integer 200

The error code.

RequestId String A6CC6C63-2D71-4D0C-AEBE-E95F0127C514

The ID of the API request.

Result

The result list of the operation.

ChaincodeId String code-sacc-fk9z4r97****

The ID of the chaincode.

ChaincodeName String mychaincode

The name of the chaincode.

ChaincodeVersion String 1.0

The version of the chaincode.

ChannelName String cc

The name of the channel.

ConsortiumId String consortium-supplychain-1pxzsp5tb****

The ID of the consortium.

CreateTime String 1545215617000

The creation time.

DeployTime String 1545215617000

The time when the chaincode was deployed.

EndorsePolicy String OR ("wholesalerMSP.peer")

The endorsement policy.

Input String input

The input property of the chaincode.

Install Boolean false

Indicates whether the chaincode is installed. A value of true indicates that the chaincode is installed. A value of false indicates that the chaincode is not installed.

Message String OK

The message.

Path String github.com/sacc

The path.

ProviderId String 1928592

The ID of the user who uploaded the chaincode.

ProviderName String uid-1928592

The user who uploaded the chaincode.

State String Running

The status.

Type Integer 1

The type of the chaincode.

Success Boolean true

Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.

Examples

Sample requests


http(s)://[Endpoint]/? Action=UpgradeFabricChaincode
&ChaincodeId=code-sacc-fk9z4r97****
&OrganizationId=peers-wholesaler-15ix77tof****
&<Common request parameters>

Successful response examples

XML format

<UpgradeFabricChaincodeResponse>
	  <Result>
		    <ProviderId>provider</ProviderId>
		    <ProviderName>name</ProviderName>
		    <ChaincodeName>mycc3</ChaincodeName>
		    <Input>args:&amp;quot;john&amp;quot; args:&amp;quot;10&amp;quot; </Input>
		    <Install>false</Install>
		    <State>Running</State>
		    <Type>1</Type>
		    <ChannelName>mychannel</ChannelName>
		    <ConsortiumId>consortium-lianmenyumingyi-hc5d1bwl****</ConsortiumId>
		    <ChaincodeVersion>0.1</ChaincodeVersion>
		    <ChaincodeId>cc-null-c856k9i1m****</ChaincodeId>
		    <Path>github.com/hyperledger/fabric-samples/chaincode/sacc</Path>
	  </Result>
	  <RequestId>2A3ABD81-95F5-4931-ACB3-31BDAE561FC7</RequestId>
	  <Success>true</Success>
	  <ErrorCode>200</ErrorCode>
</UpgradeFabricChaincodeResponse>

JSON format

{
	"Result":{
		"ChaincodeVersion":"0.1",
		"Input":"args:&quot;john&quot; args:&quot;10&quot; ",
		"ConsortiumId":"consortium-lianmenyumingyi-hc5d1bwl****",
		"State":"Running",
		"Install":false,
		"ChaincodeName":"mycc3",
		"Type":1,
		"ProviderName":"name",
		"ProviderId":"provider",
		"ChannelName":"mychannel",
		"Path":"github.com/hyperledger/fabric-samples/chaincode/sacc",
		"ChaincodeId":"cc-null-c856k9i1m****"
	},
	"RequestId":"2A3ABD81-95F5-4931-ACB3-31BDAE561FC7",
	"ErrorCode":200,
	"Success":true
}

Error codes

For more information about error codes, see Error codes.