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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jalex1604569003
Contributor
Contributor

Connection to an API

I would like to import the json content of API output with talend.

This is the output of the API in JSON that I would like to retrieve in a CSV file

0693p00000AGisGAAT.png

I've tried with this job, but I have some errors.

0693p00000AGisLAAT.png

Can anyone know how to do this?

Labels (3)
1 Reply
Anonymous
Not applicable

Hello,

You can call a Restful service using tRESTClient and get the headers from the response.

Add a tJavaRow after tRESTClient, with the following code:

 

//access to global headers

java.util.Map resp_headers = (java.util.Map<String,java.util.List<String>>)globalMap.get("tRESTClient_1_HEADERS");

 

//iterate through the list of headers

System.out.println("\nResponse Headers list:");

for(String headerName: (java.util.Set<String>) resp_headers.keySet()) {

   String headerValue = ((java.util.List<String>)resp_headers.get(headerName)).get(0).toString();

   System.out.println("\t" + headerName + ": " + headerValue);

}

Let us know if it works.

Best regards

Sabrina