云硬盘详情
该接口通过鉴权接口颁发的token作为访问令牌,云硬盘列表或者创建云硬盘返回的ID查询详情,当硬盘欠费停服后会自动卸载硬盘,重新充值会扭转成待挂载状态。
1.接口描述
接口请求地址:GET v1/PveMachineHardDisk/open/info/{id}
2.输入参数
| 参数名称 | 描述 | 是否必选 | 类型 | Location |
|---|---|---|---|---|
| Finovy-Access-Token | 令牌-口令 | yes | string | header |
| id | 云硬盘id | yes | string | path |
3.输出参数
| 参数名称 | 描述 | 类型 |
|---|---|---|
| id | 云硬盘ID | string |
| uuid | 用户ID | string |
| name | 云硬盘名称 | string |
| pveId | 主机实例ID | string |
| isMount | 是否挂载过(0未挂载、1挂载) | string |
| bus | 磁盘设备 | string |
| area | 云硬盘可用区域(0华南、1华西、2国际) | string |
| memory | 内存,单位/G | string |
| useType | 付费方式(0按量,1包时段) | string |
| amount | 价格 | string |
| status | 云硬盘状态(0待挂载、1挂载中、2使用中、3欠费停服、4销毁退还中)) | string |
| createTime | 创建时间 | string |
4.示例
示例1:请求成功示例
输入示例
GET https://client.xuandashi.com/v1/PveMachineHardDisk/open/info/p5ZvBx6rJn
Host: client.xuandashi.com
Content-Type: application/json
Finovy-Access-Token: 4vL4rcNGNcgx5v0RLCcFew
<公共请求参数>
输出示例
{
"code": 0,
"success": true,
"data": {
"id": "PgOiNCqaJQ",
"uuid": "A76543210",
"pveId": "mtK4hGbKYT",
"name": "HD-PgOiNCqaJQ",
"isMount": 0,
"bus": "scsi",
"area": "0",
"memory": 20,
"amount": 0.02,
"useType": "0",
"status": "0",
"createTime": 1704349228000
},
"msg": "success",
"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/info/p5ZvBx6rJn");
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);
}
}