Obtain URL upload information
Updated at:
Use the server-side SDK to call an OpenAPI operation and obtain URL upload information. Sample code in Java is provided.
Sample code
Debug this operation online in the Alibaba Cloud OpenAPI Developer Portal.
package main
import (
"fmt"
openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
ice "github.com/alibabacloud-go/ice-20201109/v2/client"
"github.com/aliyun/credentials-go/credentials"
"github.com/alibabacloud-go/tea/tea"
)
func main() {
// An AccessKey of an Alibaba Cloud account has access permissions for all APIs. Use a Resource Access Management (RAM) user for API calls or routine O&M.
// This example shows how to store the AccessKey ID and AccessKey secret in environment variables. For more information about the configuration, see https://help.aliyun.com/document_detail/378661.html.
credential, _err := credentials.NewCredential(nil)
if _err != nil {
panic(_err)
}
iceClient, _err := ice.NewClient(&openapi.Config{
Credential: credential,
Endpoint: tea.String("ice.cn-shanghai.aliyuncs.com"),
})
// To hard-code the AccessKey ID and AccessKey secret, use the following code. Do not store your AccessKey ID and AccessKey secret in your project code. This practice can lead to an AccessKey leak and compromise the security of all resources in your account.
// config := new(openapi.Config)
// config.SetAccessKeyId("<accessKeyId>").
// SetAccessKeySecret("<accessKeySecret>").
// SetRegionId("<regionId>").
// SetEndpoint("<endpoint>")
// iceClient, _err := ice.NewClient(config)
if _err != nil {
panic(_err)
}
// Query the information about URL upload jobs.
uploadURLs := "https://test.com"
queryRequest := &ice.GetUrlUploadInfosRequest{
UploadURLs: &uploadURLs,
}
queryResponse, err := iceClient.GetUrlUploadInfos(queryRequest)
fmt.Println(queryResponse, err)
}
Related API operation
Is this page helpful?