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
You can also debug this operation online in the Alibaba Cloud OpenAPI Developer Portal.
package com.aliyun.ice.sample;
import com.aliyun.ice20201109.Client;
import com.aliyun.ice20201109.models.*;
import com.aliyun.teaopenapi.models.Config;
public class Sample {
public static void main() throws Exception {
// An AccessKey of an Alibaba Cloud account has permissions to access all APIs. Use a Resource Access Management (RAM) user for API access or routine O&M.
// This example shows how to store an AccessKey ID and an AccessKey secret in environment variables. For information about how to configure them, see https://help.aliyun.com/document_detail/378657.html
com.aliyun.credentials.Client credentialClient = new com.aliyun.credentials.Client();
Config config = new Config();
config.setCredential(credentialClient);
// To hard-code the AccessKey ID and AccessKey secret, use the following code. However, we strongly recommend that you do not store the AccessKey ID and AccessKey secret in your project code. This can lead to an AccessKey leak, which compromises the security of all resources in your account.
// config.accessKeyId = <yourAccessKeyId>;
// config.accessKeySecret = <yourAccessKeySecret>;
config.endpoint = "ice.cn-shanghai.aliyuncs.com";
Client client = new Client(config);
SearchMediaRequest request = new SearchMediaRequest()
.setMatch("fullText = 'China'");
SearchMediaResponse searchMediaResponse = client.searchMedia(request);
System.out.println("request id : " + searchMediaResponse.getBody().getRequestId());
}
}
Related API operation
Is this page helpful?