curl进行命令post formdata json file

时间:2025-05-13 22:03:13

curl进行命令post formdata json file

    • post formdata多个参数
    • post json带头部
    • post文件
    • POST application/x-www-form-urlencoded

post formdata多个参数

多个参数可以使用-F进行串接

curl -X POST -F 'accountId=xxxxxx' -F 'meetingId=xxxx' -F 'type=1' http://192.168.10.126:8088/api/web/xxxx/checkState

post json带头部

curl -X POST -H 'Content-Type: application/json' -d '{"username":"davidwalsh","password":"something"}' http://xxxx/login

post文件

curl -X POST -F 'image=@/path/to/pictures/' http://xxxx/upload

POST application/x-www-form-urlencoded

curl -d "param1=value1&param2=value2" -X POST http://localhost:3000/data

or

curl -d "param1=value1&param2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/data