Windows 終端機使用 curl 發送 POST 請求
2023/02/08
萌芽站長
1,208 0
作業系統 , Windows
這邊教大家用 curl 在 Windows 終端機上發送 POST 請求,以測試 API 是否能正常回傳資訊。以下為示範:
curl -X POST ^
https://example.com/json ^
-H "Content-Type: application/json" ^
-d "{ ""user"": ""test"", ""token"": ""42364d7c67acd29c3c15ddf544c33671"", ""XXX"": ""YYY""}"
基本上就是把 URL 的部分改成你要的,-H 標頭已經幫忙設定為「Content-Type: application/json」,也就是發送 JSON 資訊,接著 -d 的部分就是整個要發送的 JSON 資訊囉!記得要用雙引號。
![](https://mnya.tw/cc/wp-content/plugins/native-lazyload/assets/images/placeholder.svg)
▲ 實際用上真的很方便,能直接用來測試 API 是否正常。
贊助廣告 ‧ Sponsor advertisements
Windows 11:工作列字型不一致、出現少許的新細明體?
📆 2022-06-04
📁
作業系統, Windows
Windows:終端機(命令提示字元)用指令切換到D槽
📆 2023-03-02
📁
軟體應用, 作業系統, Windows
【Elementary OS】使用軟件中心安裝FileZilla
📆 2014-04-26
📁
作業系統
Windows:自行設定網域與IP對應的「hosts」設定檔
📆 2018-08-16
📁
網站技術, 作業系統, Windows, 架站資源
Windows 11:永久停用 Windows Update 自動更新
📆 2023-10-19
📁
作業系統, Windows
關閉 Microsoft Store 應用商店自動更新
📆 2024-10-04
📁
軟體應用, 作業系統, Windows
Ubuntu x Docker x nginx-rtmp:架設 RTMP 串流伺服器不求人!快速安裝啟動教學,附贈錄影功能!
📆 2023-05-28
📁
多媒體, 作業系統, 伺服器, Linux, Ubuntu, 串流錄製
【Windows 10】註冊新詞,打字更順暢!
📆 2017-01-22
📁
作業系統, Windows
留言區 / Comments
萌芽論壇