一、云市场接口
1.控制台查看
(1)云市场接口在购买后,可以通过阿里云控制台搜索云市场进入云市场控制台
(2)点开左侧菜单项API Center-API Tools即可查看接口用量情况
2.API接口查看
(1).添加依赖
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-market</artifactId>
<version>2.0.36</version>
</dependency>
(2).JavaCode
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
/*
pom.xml
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.6.0</version>
</dependency>
*/
public class DescribeApiMetering {
public static void main(String[] args) {
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<your-access-key-id>", "<your-access-key-secret>");
/** use STS Token
DefaultProfile profile = DefaultProfile.getProfile(
"<your-region-id>", // The region ID
"<your-access-key-id>", // The AccessKey ID of the RAM account
"<your-access-key-secret>", // The AccessKey Secret of the RAM account
"<your-sts-token>"); // STS Token
**/
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.GET);
request.setSysDomain("market.aliyuncs.com");
request.setSysVersion("2015-11-01");
request.setSysAction("DescribeApiMetering");
request.putQueryParameter("productCode", "cmapi029878");
request.putQueryParameter("type", "1");
request.putQueryParameter("pageNum", "1");
try {
CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
}
}
}
(3).运行结果
{"PageSize":20,"Message":"successful","PageNumber":1,"Version":"1.0","Count":13,"Fatal":false,"Code":"200","Success":true,"Result":[{"ProductName":"印刷文字识别-公章识别/OCR文字识别(限时特惠,折扣享不停)","AliyunPk":1525534524155525,"ProductCode":"cmapi029878","TotalQuota":499,"TotalUsage":1,"Unit":"次"}]}