欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

shell腳本發(fā)送http請(qǐng)求的實(shí)現(xiàn)示例

 更新時(shí)間:2023年04月28日 11:07:08   作者:皮卡大人  
本文主要介紹了shell腳本發(fā)送http請(qǐng)求的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

簡(jiǎn)述:使用shell腳本發(fā)送http請(qǐng)求,解析請(qǐng)求獲取token再次發(fā)起請(qǐng)求

系統(tǒng):ubuntu系統(tǒng)

工具:cURL(發(fā)送http請(qǐng)求),jq(解析json),沒(méi)有需要安裝

host="192.168.1.199"
post="8888"
pre="/api/v1"
url_pre="http://${host}:${post}${pre}"
get_token="curl --location --request GET ${url_pre}/token?access_id=admin&access_secret=123456&="
echo $get_token
token=$($get_token)
echo $token
token=$(echo $token | jq  ".data.token")
token=${token:1:-1}
echo $token
curl --location --request POST ${url_pre}/device/runtime_data?token=${token} --header 'Content-Type: application/json' --data-raw '{"id_device": "d2217a3b-dfc0-4301-86f3-78fbb4cb58e4","data_type": ""}'

shell 調(diào)用HTTP POST請(qǐng)求

curl -X POST --header 'Content-Type: application/json' --header 'ReportScript-Sign: FgPlfGlYw83zMdZd' --header 'Accept: application/json' -d '{                        
    "data": {                                                                                                                                                                                     
      "appkey": "XXXXX",                                                                                                                                                                          
      "code": "bigdata.platform.XXXXX",                                                                                                                                                            
      "params": {}                                                                                                                                                                                
    },                                                                                                                                                                                            
    "extra": {}                                                                                                                                                                                                                                                                                                                                                                             
  }' 'http://XX.XX.XX.XX:XXXXX/report_api/extraFunction/commonApi'

到此這篇關(guān)于shell腳本發(fā)送http請(qǐng)求的實(shí)現(xiàn)示例的文章就介紹到這了,更多相關(guān)shell發(fā)送http請(qǐng)求內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論