This topic describes the sample code that is used to call an API operation by using the server SDK to search for media assets in Intelligent Media Services (IMS).
Usage notes
You can specify filter conditions such as the title, media asset ID, category, and status to search for media assets. You can also specify the fields by which the returned results are sorted in a specific order.
Sample code
You can use Alibaba Cloud OpenAPI Explorer to perform online debugging.
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 pair of an Alibaba Cloud account has access permissions on all API operations. We recommend that you use an AccessKey pair of a RAM user to call API operations or perform routine O&M.
// In this example, the AccessKey ID and the AccessKey secret are obtained from the environment variables. For more information, visit https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-go-access-credentials?spm=a2c63.p38356.help-menu-262060.d_1_9_1_2.16c2662axiCNKz.
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 your AccessKey ID and AccessKey secret, use the following code. We recommend that you do not save the AccessKey ID and the AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of resources within your account may be compromised.
// config := new(openapi.Config)
// config.SetAccessKeyId("<accessKeyId>").
// SetAccessKeySecret("<accessKeySecret>").
// SetRegionId("<regionId>").
// SetEndpoint("<endpoint>")
// iceClient, _err := ice.NewClient(config)
if _err != nil {
panic(_err)
}
match := "fullText = 'China'"
request := &ice.SearchMediaRequest{
Match: &match,
}
response, err := iceClient.SearchMedia(request)
fmt.Println(response, err)
}