CURL 调用可以没有“--request”参数吗?

问题描述 投票:0回答:1

以下两个请求有什么区别。

第二个没有“--request”参数,这是什么意思? 第一个调用返回身份验证令牌,第二个调用返回具有特定 id 的对象的元数据

curl --location --request POST 'https://****.azure-api.net/test/mosaic/token' \
--header 'Content-Type: application/json' \
--header 'Content-Length: 1024' \
--header 'grant_type: client_credentials' \
--header 'client_secret: ***' \
--header 'scope: bpm-portal' \
--header 'client_id: b82346bc-05f6-46ef-a1df-8fe0eaa420b8' \
--header 'Ocp-Apim-Subscription-Key: *****'
curl --location 'https://**.azure-api.net/test/mosaicId/SearchMosaicById?id=RLA217545' \
--header 'Content-Type: application/json' \
--header 'Content-Length: 1024' \
--header 'grant_type: client_credentials' \
--header 'client_secret: ****' \
--header 'scope: bpm-portal' \
--header 'client_id: b82346bc-05f6-46ef-a1df-8fe0eaa420b8' \
--header 'Ocp-Apim-Subscription-Key: *****' \
--header 'Authorization: Bearer "*****' \
--header 'Accept: application/xml'

我在邮递员中对此进行了测试。 第一次调用正常,但第二次调用失败“HTTP 错误 400。请求谓词无效。”应该使用哪种类型的请求??

curl httpclient
1个回答
0
投票

不能没有类型

没有此参数的语法意味着 GET 类型

© www.soinside.com 2019 - 2024. All rights reserved.