【问题标题】:How to use Talend for a Rest API Post?如何使用 Talend 进行 Rest API 发布?
【发布时间】:2023-01-17 15:49:10
【问题描述】:
I'm using Talend Open Studio for ESB - Version: 8.0.1. I have a job that loops thru data and creates a CSV for each data element, like this:

> ID     DATA
> A      QQQQ#$%$
> B      WWWE^UTU

etc. The job creates FileA.csv, then FileB.csv etc. That all works, but the next step I need will take FileA.csv and POST that data to an API.
The URI for each file is different, so I'm using a context to create the link. The links look like this:

https://:@host/updatenodes?application_code=fileA


There is a different application code for each file. I've tested the link for these files in Postman, and they all work, here's the message:

"result": "success",
"message": "Update batch submitted with 0 items",
"threadId": []

So, the links are correct. In Talend ESB, I'm using a tFileFetch object with Post Method checked. The file image_Tal.png shows the settings
of the tFileFetch. When I use a context URL, I get this error:

> Exception in component tFileFetch_1 (Cognosos)
> java.lang.IllegalArgumentException: host parameter is null

I also tried hard-coding the full URL into the filefetch object, I get this error:

Sep 08, 2022 1:49:39 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: no further information

So, how do I post the data from the CSV to the API? I've tried tRest, but it wouldn't allow me to use a context variable as the URI.
Because each different file has a different ID/Password, I need to use a variable for each iteration in the loop. When I use a
context for the URI, it gives me the error "URI is not absolute". I had the same problem with RestRequest and RestClient.

Are there some settings I need to add to Talend ESB? I'm using the defaults now - I'm not sure what settings to change. 


![enter image description here](https://i.stack.imgur.com/A6NA3.png)


我已经尝试了 tRest 和 tRestRequest 对象,但是我在使用 URI 上下文时遇到错误。我正在尝试获取 CSV 数据以 POST 到 API。

【问题讨论】:

    标签: rest post talend


    【解决方案1】:

    想检查您是否找到了所需功能的解决方法。 我也在努力实现同样的目标。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-02
      • 1970-01-01
      • 1970-01-01
      • 2019-03-05
      • 2016-09-01
      • 1970-01-01
      相关资源
      最近更新 更多