一、安装json解析工具

npm install -g json

二、返回数据统一格式

名称 类型 描述
code Integer 0:正常;1:异常
message String 状态信息
data String 业务数据

三、获取token

地址:http://work.bigops.com/api/bigops/v1/auth

方法:POST

请求参数:

名称 类型 必须 描述
account String 用户账号
password String 用户密码

例子:

执行命令:

curl -s -X POST -H "Content-Type: application/json" -d '{"account":"xxxxxx","password":"xxxxxx"}' http://work.bigops.com/api/bigops/v1/auth | json

返回值:

{"code":0,"message":"ok","data":"b0a2e800dd524f9c9a9cef87ef479d74"}

四、主机信息

说明:根据服务树路径,查找主机

地址:http://work.bigops.com/api/bigops/v1/describeHosts?token=xxxxxx

方法:POST

请求参数:

名称 类型 必须 描述
token String 用户token

例子:

curl -X POST "http://work.bigops.com/api/bigops/v1/describeHosts?token=b0a2e800dd524f9c9a9cef87ef479d74" -H "accept: */*" -H "Content-Type: application/json" -d '{ "serviceTreePaths": [ "运维部/测试环境/test/测试服务" ]}' | json

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "storageController": null,
      "wanVip": null,
      "displayDetail": null,
      "deliveryOrderNumber": null,
      "productName": null,
      "lanVip": null,
      "hostname": "172.31.173.22",
      "debugMonStauts": false,
      "price": null,
      "supplier": null,
      "ctime": "2020-06-02 17:09:14",
      "zbxAgentVersion": null,
      "macaddress": null,
      "id": 34,
      "cpuDetail": null,
      "cpuCount": null,
      "height": null,
      "bwBillingDetail": null,
      "imageId": null,
      "instanceSpecsFamily": null,
      "ak": "9a3z/ibG+N4U3pos0iw42oe2O1EXNrxOZV3kAVUI/Lx4JKVYcpPjKeXa7fpKY/4",
      "agentMtime": null,
      "aiChipType": null,
      "ipmiOverLan": null,
      "status": "启用",
      "baseboardModel": null,
      "template": null,
      "aiChipCount": null,
      "virtType": null,
      "diskTotal": null,
      "assetTag": null,
      "crondMtime": null,
      "distribution": null,
      "eip": null,
      "wanVipv6": null,
      "instanceId": null,
      "memUsage": null,
      "memDetail": null,
      "wanIpv6": null,
      "cspZone": null,
      "powerDetail": null,
      "baseboardVendor": null,
      "cpuGrowth": null,
      "instanceNetworkType": null,
      "specsBilling": null,
      "architecture": null,
      "memGrowth": null,
      "bwLineType": null,
      "kernel": null,
      "bwBillingType": null,
      "updateTime": null,
      "systemCat": "Linux",
      "instanceSpecs": null,
      "productVendor": null,
      "nodename": null,
      "distributionMajorVersion": null,
      "debugMtime": null,
      "maintenanceEtime": null,
      "cpuUsage": null,
      "mtime": "2020-06-04 15:32:10",
      "wanIp": null,
      "instanceBillingType": null,
      "racModel": null,
      "usageMtime": null,
      "distributionVersion": null,
      "lanVipv6": null,
      "diskPart": null,
      "crondStatus": "未知",
      "productSerial": null,
      "bwBillingModel": null,
      "crontab": null,
      "renewalStatus": null,  
      "contractNumber": null,
      "bigproxy": null,
      "cpuCores": null,
      "name": "172.31.173.22",
      "moduleDetail": null,
      "position": null,
      "projectName": null,
      "diskDetail": null,
      "lanIp": "172.31.173.22",
      "raid": null,
      "creationTime": null,
      "instanceName": null,
      "debugMonMsg": null,
      "zbxHostid": null,
      "totalUsage": null,
      "zbxAgentMtime": null,
      "aiChipModel": null,
      "baseboardSerial": null,
      "nicDetail": null,
      "debug": null,
      "specsBillingModel": null,
      "memTotal": null,
      "resCatId": 4,
      "buyTime": null,
      "vcpus": null,
      "bwBilling": null,
      "expiredTime": null,
      "maxBw": null,
      "purchaseOrderNumber": null,
      "lanIpv6": null,
      "agentVersion": null
    }
  ]
}

五、用户信息

说明:根据Account名字,显示用户详细信息

地址:http://work.bigops.com/api/bigops/v1/describeUsers?token=xxxxxx

方法:POST

请求参数:

名称 类型 必须 描述
token String 用户token

例子

curl -X POST "http://work.bigops.com/api/bigops/v1/describeUsers?token=b0a2e800dd524f9c9a9cef87ef479d74" -H "accept: */*" -H "Content-Type: application/json" -d '{ "userAccounts": [ "xxxxxxxx" ]}' | json

返回数据:

{
  "code": 0,
  "message": "ok",
  "data": [
    {
      "template": null,
      "leader": null,
      "debug": null,
      "sshPubkey": null,
      "resCatId": 2,
      "mobile": "1991999xxxxx",
      "ak": null,
      "avatar": null,
      "mtime": "2020-06-11 16:28:21",
      "title": null,
      "dingding": "695748470510285xxxx",
      "mfaSecretkey": null,
      "weixin": "xxxxxx",
      "debugMtime": null,
      "phone": null,
      "etime": "9999-01-01 01:01:01",
      "name": "test",
      "nickname": "admin",
      "ctime": "2020-05-20 16:24:13",
      "id": 138,
      "ssoMfa": "禁用",
      "account": "19919992991",
      "email": "xxxx@qq.com",
      "status": "启用"
    }
  ]
}

results matching ""

    No results matching ""