tencent cloud

Connecting to TencentCloud API
Last updated:2025-01-14 19:41:39
Connecting to TencentCloud API
Last updated: 2025-01-14 19:41:39
TencentCloud API 3.0 integrates SDKs for multiple programming languages, making it easier for you to call APIs. It supports nearby access, and the domain name for nearby access is faceid.tencentcloudapi.com. It also supports access using a domain name with a specified region, for example, the domain name for the Singapore region is faceid.ap-singapore. tencentcloudapi.com.
We recommend that you use the domain name for nearby access. When you call an API, the request is automatically resolved to a server in the region nearest to the location where the API is called. For example, if a request is made in Singapore, it will be automatically resolved to a server in Singapore, which has the same effect as specifying faceid.ap-singaporef.tencentcloudapi.com.
Note:
1. For latency-sensitive businesses, we recommend that you specify the region in the domain name.
2. A domain name is an API access point and does not represent the region where the product or API actually provides services. For the list of regions supported by the product, see the call method/common parameter document. For the regions supported by the API, see the input parameters part in the API document.
You can select the language you are familiar with for coding. This section uses the Go language as an example to show how to integrate the Tencent Cloud SDK into your server.

Environmental dependency

1. Go 1.9 or above, with the necessary environment variables such as GOPATH set properly.
2. Activate the eKYC product by following the process guide.
3. Obtain SecretId and SecretKey by following the guide to getting the secret key.

Installation

Installing through go get (recommended)

We recommend you install the SDK by using the tool that comes with the language.
go get -u github.com/tencentcloud/tencentcloud-sdk-go-intl-en

Installing through source code

Go to the GitHub page to download the latest code, and decompress it to $GOPATH/src/github.com/tencentcloud.

Integrating into the server

After the Tencent Cloud SDK is installed, you can use the import command to integrate the SDK into the server. The sample code is as follows:
package main

import (
"fmt"
cloud "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/profile"
faceid "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/faceid/v20180301"
)

func main() {
// Instantiate a client configuration object. You can specify the timeout period and other configuration items
prof := profile.NewClientProfile()
prof.HttpProfile.ReqTimeout = 60
// TODO replace the SecretId and SecretKey string with the API SecretId and SecretKey
credential := cloud.NewCredential("SecretId", "SecretKey")
// Instantiate the client object of the requested faceid
FaceIdClient, _ := faceid.NewClient(credential, "ap-singapore", prof)

// Instantiate the request object and provide necessary parameters
request := faceid.NewGetFaceIdTokenIntlRequest()
var SecureLevel = "4"
request.SecureLevel = &SecureLevel
// Call the Tencent Cloud API through FaceIdClient
response, _ := FaceIdClient.GetFaceIdTokenIntl(request)
// Process the Tencent Cloud API response
fmt.Println("response: ", *response.Response.SdkToken)
}


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback