並且第一個接口的返回值中部分參數得作為第二個接口的入參,所以做了如下shell驗證
第一個接口返回的response body串:
{
"bizCode": "1",
"bizDesc": "success",
"item": [
{
"age": "20",
"name": "shaoshao"
},
{
"age": "21",
"name": "shaoshaoqi"
}
],
"success": true
}
處理shell:
#! /bin/bash
#-----------------------------
#auther__shaozhiqi
#-----------------------------
declare POST_URL=http://192.168.1.101:8040/user/all
echo curl -i -X POST -H "'Content-type':'application/json'" '${POST_URL}' > temp.log
cat temp.log >> info.log
source temp.log > result
biz_desc=$(cat result | sed 's/,/\n/g' | grep "bizDesc" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g'| sed 's/"//g')
echo $biz_desc
cat result >> info.log
#接下來biz_desc的值就可以作為調用第二個接口的參數了
#這里只是驗證,沒有按照規范寫
行結果:

