You can call API operations of Image Search by sending URL-based HTTP or HTTPS requests. Each URL must contain request parameters. This topic describes the syntax of HTTP or HTTPS requests and provides the endpoints of Image Search.
Endpoints
Region | Region ID | Public endpoint | VPC endpoint |
China (Hangzhou) | cn-hangzhou | imagesearch.cn-hangzhou.aliyuncs.com | imagesearch-vpc.cn-hangzhou.aliyuncs.com |
China (Shanghai) | cn-shanghai | imagesearch.cn-shanghai.aliyuncs.com | imagesearch-vpc.cn-shanghai.aliyuncs.com |
China (Beijing) | cn-beijing | imagesearch.cn-beijing.aliyuncs.com | imagesearch-vpc.cn-beijing.aliyuncs.com |
China (Shenzhen) | cn-shenzhen | imagesearch.cn-shenzhen.aliyuncs.com | imagesearch-vpc.cn-shenzhen.aliyuncs.com |
Singapore | ap-southeast-1 | imagesearch.ap-southeast-1.aliyuncs.com | imagesearch-vpc.ap-southeast-1.aliyuncs.com |
China (Hong Kong) | cn-hongkong | imagesearch.cn-hongkong.aliyuncs.com | imagesearch-vpc.cn-hongkong.aliyuncs.com |
Japan (Tokyo) | ap-northeast-1 | imagesearch.ap-northeast-1.aliyuncs.com | imagesearch-vpc.ap-northeast-1.aliyuncs.com |
Germany (Frankfurt) | eu-central-1 | imagesearch.eu-central-1.aliyuncs.com | imagesearch-vpc.eu-central-1.aliyuncs.com |
If you use Image Search on the China site (aliyun.com), you can select only the China (Shanghai), China (Hangzhou), China (Shenzhen), and China (Beijing) regions.
You can use a virtual private cloud (VPC) endpoint to call API operations of Image Search from Elastic Compute Service (ECS) instances or resources in the same VPC. For example, if your Image Search instance resides in the China (Hangzhou) region, the ECS instances or resources for accessing Image Search over a VPC must also reside in the China (Hangzhou) region. Otherwise, the operations fail to be called.
If you call API operations of Image Search by using a VPC endpoint, no Internet traffic is generated on ECS instances. For more information, see the Use a VPC endpoint to call API operations of Image Search section of this topic.
Communication protocols
You can send requests over HTTP or HTTPS. We recommend that you use HTTPS to improve security.
Request method
You can send HTTP POST requests.
Request parameters
Make sure that all the requests contain common request parameters and operation-specific request parameters.
Character encoding
All requests and responses are encoded in UTF-8
.
Use a VPC endpoint to call API operations of Image Search
The following code provides an example on how to call API operations by using a VPC endpoint based on SDK V3:
# Use a VPC endpoint.
authConfig.endpoint = "imagesearch-vpc.cn-shanghai.aliyuncs.com";
# Add a configuration item.
authConfig.endpointType = "internal";
For more information about how to call API operations by using the SDK for Java, see the Add section of the SDK for Java topic.
You can use a virtual private cloud (VPC) endpoint to call API operations of Image Search from ECS instances or resources in the same VPC. For example, if your Image Search instance resides in the China (Hangzhou) region, the ECS instances or resources for accessing Image Search over a VPC must also reside in the China (Hangzhou) region. Otherwise, the operations fail to be called.
The following code provides an example on how to call API operations by using a VPC endpoint based on an SDK earlier than V3:
// The AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you call API operations or perform routine O&M as a Resource Access Management (RAM) user.
// We recommend that you do not hard code your AccessKey ID or AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of all resources within your account is compromised.
// In this example, the AccessKey ID and AccessKey secret are saved as environment variables. You can also save the AccessKey ID and AccessKey secret to a configuration file based on your business requirements.
IClientProfile profile = DefaultProfile.getProfile("cn-shanghai", System.getenv("CC_AK_ENV"), System.getenv("CC_SK_ENV"));
# Use a VPC endpoint.
DefaultProfile.addEndpoint("cn-shanghai", "ImageSearch", "imagesearch-vpc.cn-shanghai.aliyuncs.com");
this.client = new DefaultAcsClient(profile);