跳转至

创建容器订单

接口说明

  • 功能: 容器购买,订单创建
  • 请求URI: https://api.gpuez.com/zsc/open/api/v2/console/order/create
  • 请求方法: POST

鉴权

该接口需要通过 Basic 认证。请查看接口鉴权文档 接口鉴权

请求参数

参数 必选 类型 说明
template_id true integer 模版ID,可请求算力列表接口获取
machine_id true integer 机器ID,可请求算力列表接口获取
image_id true integer 镜像ID,可请求镜像列表接口获取
user_id false integer 子用户ID,可请求创建用户接口获取,分销商账号必填
order_type true integer 订单类型[1:产品新购]
product_type true integer 产品类型[1:容器实例]
rent_type true integer 租赁类型[1:按量租赁,2:包日,3:包周,4:包月](分销商账号仅支持按量支付)
rent_count true integer 租赁时长,按量租赁传1,包年月传对应的租赁时长
data_disk_size true integer 扩容数据盘大小,单位B,例如扩容10G为(10*1024*1024*1024),传0代表不扩容

返回字段

返回字段 字段类型 说明
code integer 错误码
message string 返回信息
trace string 请求ID
data.detail.rent_type integer 租赁类型,[1: 按量租赁]
data.detail.rent_count integer 租赁时长,单位根据 rent_type 确定,分别为 时/天/周/月
data.detail.rent_free integer 租赁赠送时间,单位根据 rent_type 确定,分别为 时/天/周/月
data.detail.rent_start_at string 租赁起始时间
data.detail.machine_id integer 主机ID
data.detail.container.id integer 容器ID
data.detail.container.name string 容器名
data.detail.container.data_disk_size integer 容器数据盘大小
data.detail.template_id integer 模板ID
data.detail.template_price string 租赁价格
data.detail.template_amount string 租金金额
data.detail.template_discount string 优惠金额
data.detail.user_discount string 用户折扣,取值范围:0~1
data.detail.order_amount string 订单金额
data.detail.pay_amount string 支付金额
data.detail.refund_amount string 退款金额
data.detail.sno string 订单号

接口请求示例

请求示例:

curl --user 'ywpkds6mkks9whwwgqwbaxypqo03zklu:lchkswmht6evpk1csllxdntf6t9bzy0d' \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"template_id":10045,"machine_id":10027,"image_id":10088,"user_id":1000037,"order_type":1,"product_type":1,"rent_type":1,"rent_count":1}' \
    "https://api.gpuez.com/zsc/open/api/v2/console/order/create"

返回示例:

{
  "code": 200,
  "msg": "success",
  "trace": "2c1bf6e0-1d64-11ef-9aef-37a20a30eaff",
  "data": {
    "detail": {
      "sno": "1418781546560000",
      "rent_type": 1,
      "rent_count": 1,
      "rent_free": 0,
      "rent_start_at": "2024-05-29T10:35:54.65583+08:00",
      "machine_id": 10007,
      "container": {
        "id": 10315,
        "name": "1423077342750000",
        "data_disk_size": 53687091200
      },
      "user_discount": "1",
      "template_id": 50,
      "template_price": "1",
      "template_amount": "1",
      "template_discount": "0",
      "order_amount": "0",
      "pay_amount": "0",
      "refund_amount": "0"
    }
  }
}