Search for media assets
Updated at:
You can use a server-side SDK to call the SearchMedia operation and search for media assets in Intelligent Media Services. This topic provides sample code in Java.
Usage notes
You can filter media assets by title, media asset ID, classification, and status. You can also specify the sort field and sort order for the results.
Sample code
To debug this operation online, use 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 information about how to configure them, 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. We strongly recommend that you do not save the AccessKey ID and AccessKey secret in your project code. Saving them in your code may cause 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)
}
match := "fullText = 'China'"
request := &ice.SearchMediaRequest{
Match: &match,
}
response, err := iceClient.SearchMedia(request)
fmt.Println(response, err)
}
Related API operation
Is this page helpful?