how to extract rest API results into columns

Highlighted
Four Stars

how to extract rest API results into columns

Anyone could help on how to extract results  from an API (https://minelead.io/docs/#operation/Search ) and split them into columns

i have a simple job with tRest components that is working

Also, what is the difference between tRestClient vs tRest ?

 

Image attached

Thanks,
Developer @ minelead.io
Twelve Stars

Re: how to extract rest API results into columns

hi,
your rest application is replying with json format.
so you can use tXmlMap to split it into columns.
good luck

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Five Stars

Re: how to extract rest API results into columns

Hi @AmiHall1 ,


Concerning tRest / tRestClient :
As @xdshi explained in this post : https://community.talend.com/t5/Design-and-Development/tRest-v-s-tRestClient/td-p/99188
"component tRestClient exist in talend open studio under the ESB package using Apache CXF technology, but the tRest is under the Internet package using the technology of Rest. They need different Configuration parameters and technology. You can choose one of them which is up to your requirement and technology."

 

About how converting json response from api into columns,
i recomand you to see this :https://help.talend.com/reader/sgE1qM_4~9kOIJyS0XV1zA/WDdZLETtsTtpdN7TRzEF~g
and this : https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html

tExtractJsonField  component can parse a json string and generate rows with a schema, based on jsonPath or XPath query defined in the configuration.

For example, if you have a json like :
{"name":"totoro", "country":"japan"}
The JsonPath query to get name value could be : "$.name" and it would return a String.

 

This is how to convert a string (Valid Json) in a row with schema structure:
Job Design : tFixedFlowInput ---- tExtractJsonField ---- tLogRow

Config of tFixedFlowInput for this example :
1fixed.PNG

 

 

 

Config of tExtractJsonField :

2json.PNG3job.PNG

 

 

This is how you can "convert" a json string (which in your case is the response from the API) in row with schema.

 

The json was {"name":"totoro", "country":"japan"}
And the result is :
name  | country (schema)
totoro  | japan (row)

 

Hope this will help you.
Best regards.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog