linux之curl

0、基本参数

  1. -X--request: 指定请求方法,例如 POST

  2. -d--data: 发送指定的数据作为POST请求的主体。数据可以是键值对的形式。

  3. -H--header: 添加自定义HTTP头部。可以多次使用以添加多个头部。

  4. -F--form: 用于发送表单数据,特别是文件上传。

1、发送post请求

curl -X POST "http://xxx.xxx.x.xxx:xxxx/api/query/template" \
-H "Content-Type: application/json" \
-d '{
    "user_id": 223,
    "type": 1,
    "sign": "4ECD47349E77397B6FD0184C300CD8B9"
}'
curl -X 'POST' \
  'http://xxx.xxx.x.xxx:xxxx/api/file/upload?scene_id=1&session_id=1213123131' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@tmplt01.xlsx;type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

2、发送get请求

curl -X 'GET' \
  'http://xxx.xxx.x.xxx:xxxx/api/get_file/1111.xlsx' \
  -H 'accept: application/json'


-------------------------------------------------------------------


curl -X 'GET' \
'http://xxx.xxx.x.xxx:xxxx/api/chat/history/a5874547-6aa1-4607-a64c-3333635886cb' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjYyMTg2ODcsInN1YiI6IjE1MDcxMjA3NDUyIn0.RVeIW74ETqoyxbjLmVzEelLzE-8xto-CLD3mryCLGEw'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值