在linux和Windows使用curl,使用POST提交JSON数据

47 篇文章 0 订阅
43 篇文章 0 订阅

在linux

  • &需要用&转义

GET:

curl  http://119.29.151.177/account/password/find?channel=2201\&account=abc

POST:

curl -X POST http://demo.wiliamy.com/account/password/find?channel=2201\&account=abc

使用POST提交JSON数据

curl -l -H "Content-Type:application/json" -H "Accept:application/json" -X POST -d "{ \"studentId\":661, \"courseIds\":[3,19,27], \"status\":\"STARTED\"}" http://10.0.00.00:8080/search/status

在windos power shell

-&需要用双引号括起来

GET:

curl  http://demo.com/account/password/find

POST:

curl  http://demo.com/account/password/find?channel=2201"&"account=abc  -Method post

我们可以用get-help 看帮助信息:

 get-help Invoke-WebRequest
 名称
    Invoke-WebRequest

语法
    Invoke-WebRequest [-Uri] <uri>  [<CommonParameters>]


别名
    iwr
    wget
    curl


备注
    Get-Help 在此计算机上找不到该 cmdlet 的帮助文件。它仅显示部分帮助。
        -- 若要下载并安装包含此 cmdlet 的模块的帮助文件,请使用 Update-Help。
        -- 若要联机查看此 cmdlet 的帮助主题,请键入: "Get-Help Invoke-WebRequest -Online" 或
           转到 http://go.microsoft.com/fwlink/?LinkID=217035。

格式化输出

curl后面加 |python -m json.tool

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值