Windows 終端機使用 curl 發送 POST 請求
2023/02/08
萌芽站長
979 2
作業系統 , 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 資訊囉!記得要用雙引號。
▲ 實際用上真的很方便,能直接用來測試 API 是否正常。
贊助廣告 ‧ Sponsor advertisements
【Windows】我的電腦幾核心?
📆 2013-01-01
📁
作業系統, Windows
處理程序(Process)的三態變化:備妥狀態(Ready State)、執行狀態(Running State)、懸置狀...
📆 2019-03-26
📁
作業系統, 學業筆記
Windows 10 創作者更新(Creators Update)搶先體驗!
📆 2017-04-06
📁
作業系統, 資訊新聞, Windows
【Windows 10 Build 9841】Technical Preview 技術預覽版安裝教學
📆 2014-10-03
📁
作業系統, Windows
【Windows 7】關閉Aero半透明或切換成傳統介面
📆 2014-07-31
📁
作業系統, Windows
【Windows 10 Build 10162】初次嘗試使用記錄
📆 2015-07-15
📁
作業系統, Windows
【Elementary OS】初次嘗試使用記錄
📆 2014-04-24
📁
作業系統, Linux, Elementary OS
Windows:設定自動工作排程執行 .bat 批次檔
📆 2021-12-23
📁
作業系統, Windows
留言區 / Comments
萌芽論壇