Preparing to call contract service APIs

更新时间:
复制 MD 格式

You can call the Contract Service through OpenAPI. This topic uses the Digital Certificate Contract Service as an example to explain how to use the multi-language software development kits (SDKs) provided by AntChain to integrate your business system and call the Contract Service APIs. The operations for other supported contract services are similar.

Environment preparation

Step 1: Get the contract service ID

To call the Digital Certificate Contract API, you must first activate the Digital Certificate Contract Service and create a service instance to obtain the contract service ID (service_id).

  • To activate the Digital Certificate Contract Service, see Activation flow.

  • To create a Digital Certificate Contract Service instance, see Create a Digital Certificate Contract Service.

    After the instance is created, navigate to the Contract List and click View in the Actions column for the instance.

    On the product page for the service instance, obtain the service_id.

Step 2: Get the application ID and key

Create an application and associate it with the service instance to grant authorization. Then, obtain the application ID (accessKeyId) and application key (accessKeySecret).

  • To create an application, see Create an application.

  • To associate the application with the Digital Certificate Contract Service instance, see Associate a contract.

    After a successful association, obtain the application ID (accessKeyId) and application key (accessKeySecret) from the Application Authorization List.

    Note

    Click the eye icon image next to the application key to view it in plaintext.

SDK dependencies

You can call the Contract Service API from your business system through OpenAPI. To simplify integration, AntChain provides SDKs for seven languages: Java, C#, Go, PHP, Python, TypeScript, and Node. The dependencies for each SDK are listed below.

Java

  • SDK address

  • Direct dependency

    <dependency>
        <groupId>com.antgroup.antchain.openapi</groupId>
        <artifactId>openapi-caasplatform</artifactId>
        <version>1.5.1</version>
    </dependency>
  • Indirect dependencies

    <dependency>
      <groupId>com.antgroup.antchain.openapi</groupId>
      <artifactId>antchain-util</artifactId>
      <version>0.1.9</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>tea-util</artifactId>
      <version>0.2.21</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>tea-rpc-util</artifactId>
      <version>0.1.3</version>
    </dependency>
    <dependency>
      <groupId>com.aliyun</groupId>
      <artifactId>tea</artifactId>
      <version>1.2.9</version>
    </dependency>
    <dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>oss-util</artifactId>
        <version>1.0.0</version>
    </dependency>

PHP

  • SDK version: 1.5.1

  • SDK address

  • Dependency management: composer require antchain/caasplatform

C#

  • SDK version: 1.5.1

  • SDK address

  • Dependency management: NuGet\Install-Package AntChain.SDK.CAASPLATFORM -Version 1.4.0

Go

  • SDK version: 1.5.1

  • SDK address

  • Dependency management: go get github.com/antchain-openapi-sdk-go/caasplatform

Python

  • SDK version: 1.5.1

  • SDK address

  • Dependency management: pip install antchain-caasplatform

TypeScript

  • SDK version: 1.5.1

  • SDK address

  • Dependency management: npm i @antchain/caasplatform

Node

  • SDK version: 1.5.1

  • SDK address

  • Dependency management: npm i @antchain/caasplatform