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

编程知识 更新时间:2023-04-06 21:57:33

在linux

  • &需要用&转义

GET:

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

POST:

curl -X POST http://demo.wiliamy/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/account/password/find

POST:

curl  http://demo/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/fwlink/?LinkID=217035。

格式化输出

curl后面加 |python -m json.tool

更多推荐

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

本文发布于:2023-04-06 21:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/c8fd45c8695d2c8710996cd9808024b5.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   Windows   linux   curl   JSON

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 50999文章数
  • 14阅读数
  • 0评论数