【发布时间】:2019-03-06 16:13:15
【问题描述】:
如何将以下 cURL 命令转换为 Postman 休息调用?
curl -X POST abc.com/input.import
-H 'content-type: application/x-www-form-urlencoded'
--data-urlencode "apiKey=123-456"
--data-urlencode "secret=12/her"
--data-urlencode "userKey=ApUR"
--data-urlencode "email=fakeImportedAccount@example.com"
--data-urlencode "profile={'firstName':'John','lastName':'Kira'}"
我尝试了以下方法:
网址:(POST) abc.com/input.import
标头:Content-Type:application/json
主体:
{
"apiKey":"123-456",
"userKey":"ApUR",
"secret":"12/her",
"email":"fakeImportedAccount@example.com",
"profile": {
"firstName":"John",
"lastName":"Kira"
}
}
编辑:Postman 中的原始正文格式是必需的。导入以"x-www-form-urlencoded" 形式创建请求
【问题讨论】:
-
不要将 content-type 设置为 applicaiton/json。在正文部分,选择 application/x-www-form-urlencoded,它会自动为您设置标题。然后只需设置不同的键值对。
-
更新了问题。
-
在每个示例中,您使用不同的内容类型
-
@Evert 他们不是可兑换的吗?