尝试 POST 时 Talend Open Studio tRestClient 出错 [英] Talend Open Studio tRestClient errors out when trying to POST
问题描述
我正在尝试使用 tRestClient 将基本行发布到 REST API,但我不断收到错误 HTTP 400 错误请求.我尝试 GET 从 REST API 取回数据,它工作正常,只是执行 POST/PUT 失败.我相信这可能是 POST 正文的构造方式.我正在尝试发布 JSON 对象.我还尝试使用 tWriteJSONField 为 POST 构建 JSON,但我仍然收到相同的消息.有人知道如何通过 Talend 将 JSON 对象发布到 REST API 的正确方法吗?他们的文档并不是很有帮助.
I'm trying to POST a basic row to a REST API using tRestClient and I keep getting an error HTTP 400 Bad Request. I tried GET to get data back from the REST API and it works fine, just doing POST/PUT fails. I believe that it might be how the body of the POST is being constructed. I'm trying to POST JSON object. I also tried Using tWriteJSONField to construct the JSON for POST and I still get the same message. Does Anyone know a proper way How to POST JSON object via Talend to a REST API? Their documentation hasn't been very helpful.
推荐答案
如果你想提供一个 JSON 对象,你应该使用组件 tRest 并激活 POST 模式.一个新框 HTTP Body 打开.在这里,您可以像这样输入 JSON:
If you want to provide a JSON object, you should use the component tRest and activate POST mode. A new box HTTP Body opens up. Here you can enter the JSON like so:
"{
\"MyJSONParam\":\"category_a\",
\"MyJSONValue\":\"5678\"
}"
如果您想使用tRestClient,您只需将参数放在查询参数:框中,然后添加您想要的所有内容.
If you want to use tRestClient, you simply have to put the parameters in the box Query parameters: and add everything you want.
这篇关于尝试 POST 时 Talend Open Studio tRestClient 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!