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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Getting information from API using trestclient and dynamic parameters

Hello everyone,

 

Please do apologize any if my question lacks any information, I'm new to Talend.

Currently I'm trying to integrate a database to tableau with my self taught talend skills, and I've been quite successful at doing so, but I've been stuck at this part for quite some time and have not been able to figure it out on my own.

 

As the business receives cash from different currencies, I'm trying to use fixer.io's API to automatically get the currency code, which is on a table, the date, and then make a call to get that months exchange rate to USD.

 

However, I've not been able to even successfully get a generic and static API call to successfully go through, I've created a scratch paper job to try different configurations, I've tried trest, and trest client, read the documentation and other topics on the subject can't make it work.

The API goes as follow:

// "latest" endpoint - request the most recent exchange rate data
http://data.fixer.io/api/latest
? access_key = YOUR_ACCESS_KEY & base = GBP & symbols = ...
// Izzat, click on the URL above to get the most recent exchange // rates for USD, AUD, CAD, PLN and MXN

 So the link would look like 

 

http://data.fixer.io/api/latest?access_key=1131540f1xxxxxxe8434bc23a&symbols=USD,AUD,CAD,PLN,MXN&format=1


 I've reset the API access key for obvious reasons. 

The date, and symbols would need to be values that I can pass from a table that I have before the call that has both a column for Date and one for Symbol.

 

But I don't quite understand how to place it in the configuration, the only way the call works and return a json is if i place a call that I already know works in the URL field, but that obiously doesn't work as that means I couldn't change it depending on the need of each row. Right now I'm outputting to a json for troubleshooting purposes, the json creates with the failed call responses from the server.

The farthest i've made it is attached as pictures, admittedly I haven't started to make the query dynamic and don't know if I'm working correctly towards that, but I believe that I am, for some reason, the trestclient adds a '=' sign after my 'latest' set date which seems to brake the call. and then add some weird characters at the end where it should be format = 1.

In advance, appreciate any help anyone might provide.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You can pass dynamic parameters in the URL, assuming you are iterating the input rows with tFlowToIterate,
tFileInputDelimited--row1-tFlowToIterate--iterate--tRestClient,
Set the URL as beblow:
" http://data.fixer.io/api/?access_key=1131540f1xxxxxxe8434bc23a&symbols="+(String)globalMap.get("row1..."

View solution in original post

5 Replies
Anonymous
Not applicable
Author

No one using fixer's API with trestclient?0683p000009MPcz.png

Anonymous
Not applicable
Author

Hi
Have you tried to add the parameters directly to the URL, and remove the latest parameter from the URL?
" http://data.fixer.io/api/?access_key=1131540f1xxxxxxe8434bc23a&symbols=USD,AUD,CAD,PLN,MXN&format=1"

From your image, I see you pass an empty value to latest parameter.

Regards
Shong
Anonymous
Not applicable
Author

If i place the link directly in the URL bar the request works, however, I need the API Parameters need to change on a per row basis, is there a way i can pass a different url to trestclient? 

Anonymous
Not applicable
Author

You can pass dynamic parameters in the URL, assuming you are iterating the input rows with tFlowToIterate,
tFileInputDelimited--row1-tFlowToIterate--iterate--tRestClient,
Set the URL as beblow:
" http://data.fixer.io/api/?access_key=1131540f1xxxxxxe8434bc23a&symbols="+(String)globalMap.get("row1..."
Anonymous
Not applicable
Author

I'll give this a shot, if I can dynamically pass URL strings that makes it perfect for my use case, thanks a lot