1. 接口地址

POST /order/openapi/cancel

2. 接口参数

{
  "orderId": "订单id",
  "reason": "取消理由"
}

3. 返回值

4. 如何调用

curl示例:

curl -X POST "http://192.168.80.143:8081/order/openapi/cancel" \
-H "Authorization: Bearer <API Key>" \
-H "Content-Type: application/json" \
-d '{
  "orderId": "190007674551866xxxx",
  "reason": "xxx"
}'

java示例:

    public static void main(String[] args) {
        Map<String, Object> jsonMap = new HashMap<>();
        //订单id
        jsonMap.put("orderId", "190007674551866xxxx");
        //取消理由
        jsonMap.put("reason", "xxx");

        //将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/cancel")
                .addHeaders(headerMap) //请求头
                .body(json) // 设置请求体
                .execute().body();

        System.out.println(result);

    }
作者:admin  创建时间:2025-03-03 09:33
最后编辑:冯豪东  更新时间:2025-06-12 03:26
上一篇:
下一篇: