Talend tRestClient Consume REST API with 1 header

ⅰ亾dé卋堺 提交于 2020-01-06 09:31:30

问题


I'm trying to call a simple 'Hello World' REST API via the GET verb. The API is only expecting one HTTP Header, Accept application/json which i've set in the Advanced Settings>HTTP Headers of my tRestClient component. However, looking at the code tab, Talend seems to automatically create another entry for the contents of the Accept Type dropdown. When i run I’m getting HTTP 406 Not Acceptable back because the API is not expecting 2 headers.

I've tested this API with other software and it responds correctly so it must be down to Talend configuration. Anybody know a way around this or had a similar issue they've resolved?

I have screenshots but unfortunately they're being blocked by my firewall at work.

Thanks


回答1:


tRESTClient defines its http headers based on the parameters you supply in the component settings. It has an "Accept Type" setting, which you can set to "JSON", this adds the http header "Accept: application/json" (this way you don't have to add it in the http headers section).

For your use case, you can also use tREST, which allows you to have complete control over http headers, it only sends those you set in the http headers section.



来源:https://stackoverflow.com/questions/48586057/talend-trestclient-consume-rest-api-with-1-header

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!