如何验证接口可用性

root@master:~# curl -X POST -H "Content-type: application/json"  -d "{\"bizCode\": \"SLb6a98\",\"code\": \"330821194812082874\", \"codeType\": \"idCard\"}"  "http:/xxx.xxx.xx.xx:xxxx/mzt_yl_sfxx?app_key=ab5b22159c2344b7b8ad428657422489&app_secret=53321c192c2da72e335eda90fc285a93" |jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   735    0   662  100    73  11033   1216 --:--:-- --:--:-- --:--:-- 12250
{
  "errorCode": 200,
  "success": true,
  "requestId": null,
  "message": "成功",
  "data": {
    "elderCode": "3978422F696A9B3333D3DB55301069AFE21158DBF52CB6A601DBD74236A63AE9",
    "idCard": "7690DECA4ECA621EA9DCFFA3C6D7B3B41356DF039B4A809858B3CC33D64EA540",
    "name": "A70382C157CDBC0E49A60E3C854CD89D",
    "sex": "男",
    "nation": "01",
    "areaCode": "330802210211",
    "areaName": null,
    "nativeAddress": "39E9275ABA0673B6CED98FD4EEA7F435370A9F9B86823017E3FD8560132488F8AF4E3202AC9E988CE96D7C96115C7F1139B54D3DD3D0B5AA4E085770FAB4E5D3",
    "residenceAddress": "39E9275ABA0673B6CED98FD4EEA7F435370A9F9B86823017E3FD8560132488F8AF4E3202AC9E988CE96D7C96115C7F1139B54D3DD3D0B5AA4E085770FAB4E5D3",
    "dataProduceTime": null
  }
}


-d 指定内容 (注意要对里面的""用\进行转移。)
-H 指定请求头 json格式
-X 指定请求方式

使用jq对返回的json数据排序
yum install -y jq
posted @ 2022-11-02 10:07  安生丶  阅读(47)  评论(0编辑  收藏  举报