API 說明
SDK 準(zhǔn)備
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>mpaas20201028</artifactId>
<version>3.3.0</version>
</dependency>
創(chuàng)建短鏈
請求參數(shù)
參數(shù)名稱 | 類型 | 是否必填 | 示例 | 描述 |
AppId | string | 是 | BB5953C300957 | 應(yīng)用 ID |
WorkspaceId | string | 是 | default | 工作空間 |
TargetUrl | string | 是 | http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y | 短鏈跳轉(zhuǎn)目標(biāo)地址 |
Domain | string | 否 | l.zkobjects.com | 自定義域名 |
Cors | boolean | 否 | true | 是否支持跨域 |
返回參數(shù)
參數(shù)名稱 | 類型 | 示例 | 描述 |
requestId | String | 2DCA4EC1-8DD9-5674-B3B1-83DF361ED49F | 請求 ID |
resultCode | String | 100 | 請求結(jié)果碼 |
resultMessage | String | success | 請求結(jié)果描述 |
resultContent | JSON | 請求結(jié)果 |
結(jié)果示例
{
"requestId": "2DCA4EC1-8DD9-5674-B3B1-83DF361ED49F",
"resultCode": "100",
"resultContent": {
"data": "https://l.zkobjects.com/4leDqykEXA8DPlzwSIdF7j",
"target": "http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y",
"version": "0"
},
"resultMessage": "success"
}
Java 代碼示例
public static void main(String[] args) {
Map map = new HashMap<>();
map.put("accessKeyId", "");
map.put("accessKeySecret", "");
map.put("regionId", "cn-hangzhou");
map.put("endpoint", "mpaas.cn-hangzhou.aliyuncs.com");
CreateLinkRequest createLinkRequest = new CreateLinkRequest();
createLinkRequest.setAppId("");
createLinkRequest.setWorkspaceId("");
createLinkRequest.setTargetUrl("");
CreateLinkResponse response = null;
Client client = null;
try {
Config config = Config.build(map);
client = new Client(config);
response = client.createLink(createLinkRequest);
Gson gson = new Gson();
System.out.println(gson.toJson(response.getBody()));
} catch (Exception e) {
e.printStackTrace();
}
}
更新短鏈
請求參數(shù)
參數(shù)名稱 | 類型 | 是否必填 | 示例 | 描述 |
AppId | string | 是 | BB5953C300957 | 應(yīng)用 ID |
WorkspaceId | string | 是 | default | 工作空間 |
TargetUrl | string | 是 | http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y | 短鏈跳轉(zhuǎn)目標(biāo)地址 |
Url | string | 是 | https://l.zkobjects.com/4leDqykEXA8DPlzwSIdF7j_0 | 短鏈地址 |
Domain | string | 否 | l.zkobjects.com | 自定義域名 |
Cors | boolean | 否 | true | 是否支持跨域 |
返回參數(shù)
參數(shù)名稱 | 類型 | 示例 | 描述 |
requestId | String | 2DCA4EC1-8DD9-5674-B3B1-83DF361ED49F | 請求 ID |
resultCode | String | 100 | 請求結(jié)果碼 |
resultMessage | String | success | 請求結(jié)果描述 |
resultContent | JSON | 請求結(jié)果 |
結(jié)果示例
{
"requestId": "A5CEBA93-BC43-5135-9863-ED510E534101",
"resultMessage": "success",
"resultCode": "100",
"resultContent": {
"target": "http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y2",
"data": "https://l.zkobjects.com/4leDqykEXA8DPlzwSIdF7j",
"version": "1"
}
}
Java 代碼示例
public static void main(String[] args) {
Map map = new HashMap<>();
map.put("accessKeyId", "");
map.put("accessKeySecret", "");
map.put("regionId", "cn-hangzhou");
map.put("endpoint", "mpaas.cn-hangzhou.aliyuncs.com");
UpdateLinkRequest updateLink = new UpdateLinkRequest();
updateLink.setAppId("");
updateLink.setWorkspaceId("");
updateLink.setTargetUrl("");
updateLink.setUrl("");
UpdateLinkResponse response = null;
Client client = null;
try {
Config config = Config.build(map);
client = new Client(config);
response = client.updateLink(updateLink);
Gson gson = new Gson();
System.out.println(gson.toJson(response.getBody()));
} catch (Exception e) {
e.printStackTrace();
}
}
查詢短鏈
請求參數(shù)
參數(shù)名稱 | 類型 | 是否必填 | 示例 | 描述 |
AppId | string | 是 | BB5953C300957 | 應(yīng)用 ID |
WorkspaceId | string | 是 | default | 工作空間 |
Url | string | 是 | https://l.zkobjects.com/4leDqykEXA8DPlzwSIdF7j | 短鏈地址 |
返回參數(shù)
參數(shù)名稱 | 類型 | 示例 | 描述 |
requestId | String | 2DCA4EC1-8DD9-5674-B3B1-83DF361ED49F | 請求 ID |
resultCode | String | 100 | 請求結(jié)果碼 |
resultMessage | String | success | 請求結(jié)果描述 |
resultContent | JSON | 請求結(jié)果 | |
Modified | String | 2024-06-12 11:00:36 | 更新時(shí)間 |
WorkspaceId | String | default | 工作空間 |
Cors | boolean | false | 是否支持跨域 |
Url | String | https://l.zkobjects.com/4leDqykEXA8DPlzwSIdF7j | 短鏈地址 |
Target | String | http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y2 | 短鏈跳轉(zhuǎn)地址 |
Created | String | 2024-06-12 11:00:36 | 生成時(shí)間 |
Dynamictarget | String | "" | 動態(tài)參數(shù) |
AppId | String | ONEX9F0069B092002 | AppId |
Version | Int | 1 | 版本號 |
Traceid | String | 3e0d2a2a1d741815aeee6fa688d4f1f6 | Traceid,業(yè)務(wù)標(biāo)識 |
Domain | String | l.zkobjects.com | 自定義域名 |
Original | JSON | 初次生產(chǎn)的短鏈信息 |
結(jié)果示例
{
"requestId": "3207B9F8-E497-5976-AE6E-D83DAEBD103F",
"resultCode": "100",
"resultContent": {
"data": {
"Modified": "2024-06-12 11:00:36",
"WorkspaceId": "default",
"Cors": false,
"Url": "https://l.zkobjects.com/4leDqykEXA8DPlzwSIdF7j",
"Created": "2024-06-12 11:00:36",
"LastModified": "2024-06-12 11:00:36",
"Target": "http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y2",
"Dynamictarget": "",
"AppId": "ONEX9F0069B09202",
"Version": 1,
"Traceid": "3e0d2a2a1d741815aeee6fa688d4f1f6",
"Domain": "l.zkobjects.com",
"Original": {
"Target": "http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y",
"Dynamictarget": "",
"Modified": "2024-05-20 16:49:26",
"AppId": "ONEX9F0069B092002",
"Version": 0,
"WorkspaceId": "default",
"Traceid": "8b926d63d04ec08285471e67a9fbc1e6",
"Domain": "l.zkobjects.com",
"Cors": false,
"Created": "2024-05-20 16:49:26"
}
},
"target": "http://bestwisewords.com/document_detail/158619.html?spm\u003da2c4g.49548.0.0.74684c7aOCNi9Y2",
"version": "1"
},
"resultMessage": "success"
}
Java 代碼示例
public static void main(String[] args) {
Map map = new HashMap<>();
map.put("accessKeyId", "");
map.put("accessKeySecret", "");
map.put("regionId", "cn-hangzhou");
map.put("endpoint", "mpaas.cn-hangzhou.aliyuncs.com");
QueryLinkRequest queryLinkRequest = new QueryLinkRequest();
queryLinkRequest.setAppId("");
queryLinkRequest.setWorkspaceId("");
queryLinkRequest.setUrl("");
QueryLinkResponse response = null;
Client client = null;
try {
Config config = Config.build(map);
client = new Client(config);
response = client.queryLink(queryLinkRequest);
Gson gson = new Gson();
System.out.println(gson.toJson(response.getBody()));
} catch (Exception e) {
e.printStackTrace();
}
}