1. 接口地址

POST /order/openapi/getProductList

2. 接口参数

{
  "pageNum": "当前页数",
  "pageSize": "分页大小"
}

3. 返回值

{
    "total": 37,
    "rows": [
        {
            "id": "1902176615603838977", //产品id
            "name": "产品1", //产品名称
            "status": 1 , // 上下架状态 1:待上架 2:已上架 3:下架
            "totalNum":8 ,//产品数量
            "productType":1 ,//产品类型 1 虚拟机 2 云容器 3 裸金属
            "computingPowerType":1,//算力类型 1:通算;2:智算;3:超算
            "cpuModel":"酷睿i5" //处理器型号
        }
    ],
    "code": 200,
    "msg": "查询成功"
}

4. 如何调用

curl示例:

curl -X POST "http://192.168.80.143:8081/order/openapi/getProductList" \
-H "Authorization: Bearer <API Key>" \
-H "Content-Type: application/json" \
-d '{
  "pageNum":0,
  "pageSize":5,
}'

java示例:

    public static void main(String[] args) {
        Map<String, Object> jsonMap = new HashMap<>();
        //当前页数 (从0开始)
        paramMap.put("pageNum", 0);
        //分页大小
        paramMap.put("pageSize", 5);
        Map<String, String> headerMap = new HashMap<>();
        headerMap.put("Authorization", "Bearer <API Key>");

        //链式构建请求
        String result = HttpRequest.post("http://xxx.xxx.xxx.xxx:xxxx/order/openapi/getProductList")
                .addHeaders(headerMap) //请求头
                .body(paramMap) // 设置请求体
                .execute().body();

        System.out.println(result);

    }
作者:冯豪东  创建时间:2025-04-11 00:48
最后编辑:冯豪东  更新时间:2025-06-12 03:26
上一篇:
下一篇: