c语言sscanf函数的用法是什么
286
2022-11-28
如何在linux中发送json&basic authorization到server
1、直接在curl中带json:
curl -i -X POST -H "'Content-type':'application/json'" -d '{"ATime":"'$atime'","BTime":"'$btime'"}' $url需要注意的是,json数据里变量要用''括起来例子:curl -H "Content-type: application/json" -X POST -d '{"phone":"13521389587","password":"test"}' "environment": "Devel", "description": "Machine for test, please do not delete!"}
在该folder上一级,使用@folder名/json file,如:
curl -X POST -k -u account:pwd -H "Accept: application/json" -H "Content-Type: application/json" -d @notification_request_json/sendSngleMsg.json class="data-table" data-id="t7a7e9d1-4FH89l5D" data-width="" style="outline: none; border-collapse: collapse; width: 100%;">
How do I set up the basic authorization?
All you need to do is use -u, --user USER[:PASSWORD]
. Behind the scenes curl
builds the Authorization
Example:
比这种要好:(公示了认证方式)
curl -i \ -H 'Accept:application/json' \ -H 'Authorization:Basic username:password' \ http://example.com
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~