curl指令模拟postman发json数据,发本地文件

菜鸟curl指令介绍:

https://www.coonote.com/linux/linux-cmd-curl.html

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/picture.jpg' 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

猜你喜欢

转载自blog.csdn.net/qq_15821487/article/details/125149854