1. 接口地址
POST /order/openapi/callBack
2. 接口参数
{
"instanceId": "实例id", //实例id
"type": 2 ,//操作方式 2 销毁 3 开机 4 关机 5 重启
"code": 200 //执行成功200 失败其他
}3. 返回值
无
4. 如何调用
curl示例:
curl -X POST "http://192.168.80.143:8081/order/openapi/callBack" \
-H "Authorization: Bearer <API Key>" \
-H "Content-Type: application/json" \
-d '{
"instanceId": "190007674551866xxxx",
"type": 1,
"code": 200
}'java示例:
public static void main(String[] args) {
Map<String, Object> jsonMap = new HashMap<>();
//实例id
jsonMap.put("instanceId", "190007674551866xxxx");
//取消理由
jsonMap.put("type", 1);
//状态码
jsonMap.put("code", 200);
//将Map转换为JSON字符串
String json = JSONUtil.toJsonStr(jsonMap);
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer <API Key>");
//链式构建请求
String result = HttpRequest.post("http://xxx.xxx.xxx.xxx:xxxx/order/openapi/callBack")
.addHeaders(headerMap) //请求头
.body(json) // 设置请求体
.execute().body();
System.out.println(result);
}作者:冯豪东 创建时间:2025-03-27 03:26
最后编辑:冯豪东 更新时间:2025-06-12 03:26
最后编辑:冯豪东 更新时间:2025-06-12 03:26