Talend Open Studio POST 请求:“缺少表单参数:grant_type”

时间:2021-03-23 20:00:58

标签: json rest post oauth-2.0 talend

我正在使用 Talend Open Studio 通过 POST 请求调用 Commerzbank API 以获取刷新令牌。 我收到错误消息“缺少表单参数:grant_type”,这让我很困惑,因为我的 tREST 组件如下所示: enter image description here

在 Postman 中,使用此配置一切正常: enter image description here

我是否需要以不同的方式/位置放置内容类型“application/x-www-form-urlencoded”?

预先感谢您的任何提示:)

2 个答案:

答案 0 :(得分:0)

我在这里弄糊涂了:x-www-form-urlencoded 不要求 json 主体,而是要求格式为 param1=value1¶m2=value2

答案 1 :(得分:0)

您可以在 Postman 查看正确级别的代码并从那里获取 Java 代码。

https://learning.postman.com/docs/sending-requests/generate-code-snippets/#:~:text=In%20Postman%2C%20select%20the%20request,copy%20your%20generated%20code%20snippet

然后您可以将想要的代码粘贴到 tjava 中。 最后一步是在 tREST 中的查询或正文中调用它。

相关问题