用户所在地区的已有内存总量统计
该接口通过鉴权接口颁发的token作为访问令牌,用户所在地区的已有内存总量统计。
1.接口描述
接口请求地址:GET v1/PveMachineHardDisk/open/memoryTotal/{area}
2.输入参数
| 参数名称 | 描述 | 是否必选 | 类型 | Location |
|---|---|---|---|---|
| Finovy-Access-Token | 令牌-口令 | yes | string | header |
| area | 云硬盘区域(0华南、1华西、2国际) | yes | string | path |
3.输出参数
| 参数名称 | 描述 | 类型 |
|---|---|---|
| memory | 内存 | Long |
4.示例
示例1:请求成功示例
输入示例
GET https://client.xuandashi.com/v1/pve/open/image
Finovy-Access-Token: 4vL4rcNGNcgx5v0RLCcFew
<公共请求参数>
输出示例
{
"code":0,
"data":{
"memory": 998
},
"msg":"success",
"success":true,
"traceId":"xxxxxxxxxxxxxx"
}
5.错误码
详情可查看通用错误码
6.Java请求示例
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main{
public static void main(String[] args) throws IOException {
URL url = new URL("https://client.xuandashi.com/v1/PveMachineHardDisk/open/memoryTotal/1");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("GET");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setRequestProperty("Finovy-Access-Token", "3V41hUWEwlwKH44m7SpJOs");
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}