Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
I've tried with this job, but I have some errors.
Can anyone know how to do this?
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