Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Consume REST API with 1 header

Hi,

 

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 of my tRestClient component. However, 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. Sorry

 

Thanks

Matt

 

 

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

OK, I would recommend just reinstalling Studio. I have seen this sort of problem happen quite a few times. It is probably quicker to reinstall than try to hunt through the broken install. Ensure you have backed up your project if you are not using the Enterprise Edition.

View solution in original post

21 Replies
Anonymous
Not applicable
Author

I may be missing something here (I'm having a quick look on my phone while on the train), but why doesn't just setting the accept type to JSON not work? You should not need the other header you are setting? Have you tried this? The number of headers set shouldn't really cause you a problem unless you are not setting enough or possibly if you are setting one twice with different values.
root
Creator II
Creator II

It may hep to post the whole RAW transaction for the GET. This seems odd that something would be added automagically.
Anonymous
Not applicable
Author

Thanks, I did try just setting the accept type to JSON but the API i'm calling is expecting something like application/sofwarename1.0json rather than just JSON so i get a 406 error again.

 

I'm currently trying to use t_Rest as this doesn't set the accept type for you but i'm getting errors with the Jersey files

 

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey.client cannot be resolved to a variable
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey.api.client.Client cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type
com.sun.jersey cannot be resolved to a type

Anonymous
Not applicable
Author

when i run fiddler to intercept what Talend is sending i can see that the tRestClient component is indeed sending 2 accept headers (ignore the application/xml in the screenshot, i forgot to take a screenshot when i tried json, the result is the same, 2 headers). 


Fiddler.jpg
Anonymous
Not applicable
Author

Accept-Type JSON in the drop down is actually "application/json". It looks like you may have selected XML there. Have you tried setting this to JSON and not adding your own header in the Advanced settings tab?

Anonymous
Not applicable
Author

Sorry that was the wrong screenshot. I did set it to JSON and get the same (Accept: application/JSON, application/*****+json. I have also tried removing what i've set in Advanced settings but still get the 406 error. I can get a response in Postman which is leading me to believe it is something with the component config in Talend.0683p000009LsCJ.jpg

Anonymous
Not applicable
Author

What file were you sending there? I think we are going around in circles. I thought you wanted to send a file somewhere, but that does not look like you are sending anything other than a JSON String in the body of the message. What exactly needs to be sent? 

Anonymous
Not applicable
Author

Sorry for the confusion, i'm new to web services and may not be using the correct terminology. I've taken a screenshot of the API i'm trying to call and how i've configured tRestClient.

 

0683p000009LsI1.jpg

0683p000009LsPD.jpg 

0683p000009LsW1.jpg

Anonymous
Not applicable
Author

Sorry, my mistake. I am trying to help two people with web service issues and I got confused as to who I was talking to