查询指定设备

  1. 请求地址:GET /machines/{id}

  2. 接口概述:

    根据设备id查询指定的设备。

  3. 请求参数:

    地址参数

    参数名 参数类型 参数说明 必需 备注
    id integer 设备id
  4. 请求体:

  5. 请求示例:

    GET /bitanswer/api/machines/{id} HTTP/1.1
    Host: back-office-api.bitanswer.cn
    Content-Type: application/json
    bitkey: ••••••
  6. 响应示例:

    {
       "status": 0,
       "data": {
           "total": 2,
           "items": [
               {
                   "status": 0,
                   "sn": "xxxxx1",
                   "customId": "custom1"
               },
               {
                   "status": 0,
                   "sn": "xxxxx2",
                   "customId": "custom2"
               }
           ]
       }
    }

    响应体说明

修改指定设备

  1. 请求地址:POST /machines/{id}

  2. 接口概述:

    根据设备id修改指定的设备的状态。

  3. 请求参数:

    地址参数

    参数名 参数类型 参数说明 必需 备注
    id integer 设备id
  4. 请求体:

    参数名 参数类型 参数说明 必需 备注
    status integer 设备状态
  5. 请求示例:

    POST /bitanswer/api/machines/{id} HTTP/1.1
    Host: back-office-api.bitanswer.cn
    Content-Type: application/json
    bitkey: ••••••
    
    {
       "status":1
    }
  6. 响应示例:

    {
       "status": 0,
       "data": {
           "total": 1,
           "items": [
               {
                   "id": 1,
                   "status": 1
               }
           ]
       }
    }

    响应体说明

删除指定设备

  1. 请求地址:DELETE /machines/{id}

  2. 接口概述:

    根据设备id删除指定的设备。

  3. 请求参数:

    地址参数

    参数名 参数类型 参数说明 必需 备注
    id integer 设备id
  4. 请求体:

  5. 请求示例:

    DELETE /bitanswer/api/machines/{id} HTTP/1.1
    Host: back-office-api.bitanswer.cn
    bitkey: ••••••
  6. 响应示例:

    {
       "status": 0,
       "data": {
           "total": 1,
           "items": [
               {
                   "id": 1
               }
           ]
       }
    }

    响应体说明

检查设备码

  1. 请求地址:POST /sns/validate_codes

  2. 接口概述:

    检查设备码是否符合要求。

  3. 请求参数:

  4. 请求体:

    参数名 参数类型 参数说明 必需 备注
    devices array 设备码列表
    code string 设备码
  5. 请求示例:

    POST /bitanswer/api/sns/validate_codes HTTP/1.1
    Host: back-office-api.bitanswer.cn
    Content-Type: application/json
    bitkey: ••••••
    
    {
     "devices": [
       {
         "code": "WRONGCODE"
       },
       {
         "code": "BVL1AA-...-...-...-...-98D9A0F61"
       }
     ]
    }
  6. 响应示例:

    {
     "status": 0,
     "data": {
       "total": 2,
       "items": [
         {
           "deviceCode": "WRONGCODE",
           "validated": false,
           "errorCode": 515,
           "errorMsg": "bit code must be start with B."
         },
         {
           "deviceCode": "BVL1AA-...-...-...-...-98D9A0F61",
           "validated": true
         }
       ]
     }
    }