Connecting REST API and extracting JSON Fields to a table

Highlighted
Five Stars

Connecting REST API and extracting JSON Fields to a table

Hi everyone,

I am pretty new to talend and has been trying to connect an API key as below to retrieve lead from a website.

However, i have been finding difficult to idetify the right information to input in my TrestClient (if tha'x the right component to use).

Show

> Example Request:

curl https://api.wishpond.com/api/v1/leads/:lead_id \
-H "X-Api-Token:YOUR_API_KEY"
> Sample Response:
{
    "lead": {
        "id": "xxxxxxx",
        "email": "someone@test.com",
        "status": "active",
        "created_at": "2015-07-xxxx",
        "updated_at": "2015-07-xxxxx",
        "lead_score": 0,
        "subscribed": true,
        "cid": "xxxxx",
        "mid": "263531",
        "dynamic_attributes": {
            "first_name": "xxxx",
            "last_name": "xxxxx"
        }
    }
}
I just want external ideas on how to go about resolving what seems difficult for me now.

 

 


Accepted Solutions
Five Stars

Re: Connecting REST API and extracting JSON Fields to a table

Thank you TRF,

Can you please precise if i should leave the path box empty with quote?

Thank you so much for you help.

View solution in original post


All Replies
Sixteen Stars TRF
Sixteen Stars

Re: Connecting REST API and extracting JSON Fields to a table

So, if I understand you search to tgranslate from curl to tRestClient.

Based on your example, here is how the component should be configured:

- URL: https://api.wishpond/api/v1/

- HTTP Method: GET

- Content Type: JSON

- Accept Type: any

- Query parameters: leads (as name) - lead_id (as value - probably issued from a global variable)

- HTTP Headers (Advanced settings): X-Api-Token (as name) - yourApiKey (as value - probably issued from a global variable)

 

Probably not so far from what you need but you have to try by yourself.

 


TRF
Five Stars

Re: Connecting REST API and extracting JSON Fields to a table

Thank you TRF,

Can you please precise if i should leave the path box empty with quote?

Thank you so much for you help.

View solution in original post

Five Stars

Re: Connecting REST API and extracting JSON Fields to a table

Thank you so much, your suggestion has been of a great help. I have resolved my issue
Sixteen Stars TRF
Sixteen Stars

Re: Connecting REST API and extracting JSON Fields to a table

Great! But you should have selected the answer which help you instead of yours...

TRF
Five Stars

Re: Connecting REST API and extracting JSON Fields to a table

Tha'x right !

I made a mistake as i am new here.

However it jut stop working with UnknownHostException invoking https://api.wishpond/api/v1/?Leads=lead_id: api.wishpond

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

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog