How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Seven Stars

How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Hi all,

can someone solve this issues?

I'm using fiddler web debug proxy, from that I'm trying to get some JSON data through trest component in Talend open studio for DI.

Following are my credentials.

1.https link

2.Post method

3.content-type : application/json

4.Accept : application/json

5restcomp1.PNGhttpbody_json.PNGerr.PNG.json data as like below

 

{
"Commit": "false",
"Client": "AvaTaxSample",
"CompanyCode": "CYPHERTAX",
"CustomerCode": "ABC4335",
"DocCode": "INV001",
"DocType": "SalesOrder",
"DocDate": "2014-01-01",
"Addresses": [
{
"AddressCode": "01",
"Line1": "2345 Carlmont Drive",
"Line2": "Suite 100",
"Line3": "ATTN Accounts Payable",
"City": "Belmont",
"Region": "CA",
"Country": "US",
"PostalCode": "94002"
}
],
"Lines": [
{
"LineNo": "1",
"DestinationCode": "01",
"OriginCode": "01",
"ItemCode": "N543",
"TaxCode": "NT",
"Description": "Red Size 7 Widget",
"Qty": "1",
"Amount": "100"
}
]
}

 

I couldn't get the results for this.

instead of json data I have tried with xml data its working fine.


Accepted Solutions
Seven Stars

Re: How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Hi,

Thanks a Lot Smiley Happy

It works fine.

I can get my output.

 

solved1.PNGoutput.PNG


All Replies
Highlighted
Forteen Stars TRF
Forteen Stars

Re: How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Hi,

The error is at compile time, not at runtime.
As I can see, the body is malformed.
It should contains a Java String enclosed between ".
If it contains " they must be protected by an \ character.
Try this 1st to correct your compile error.

TRF
Seven Stars

Re: How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Hi,

I really don't know where to use '\'. with the same JSON data, I execute in fiddler tool and I got expected output.

Seven Stars

Re: How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Hi Sir,

Can You please work on that data and show  with screenshots.

Community Manager

Re: How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

"{
\"Commit\": \"false\",
\"Client\": \"AvaTaxSample\",
\"CompanyCode\": \"CYPHERTAX\",
\"CustomerCode\": \"ABC4335\",
\"DocCode\": \"INV001\",
\"DocType\": \"SalesOrder\",
\"DocDate\": \"2014-01-01\",
\"Addresses\": [
{
\"AddressCode\": \"01\",
\"Line1\": \"2345 Carlmont Drive\",
\"Line2\": \"Suite 100\",
\"Line3\": \"ATTN Accounts Payable\",
\"City\": \"Belmont\",
\"Region\": \"CA\",
\"Country\": \"US\",
\"PostalCode\": \"94002\"
}
],
\"Lines\": [
{
\"LineNo\": \"1\",
\"DestinationCode\": \"01\",
\"OriginCode\": \"01\",
\"ItemCode\": \"N543\",
\"TaxCode\": \"NT\",
\"Description\": \"Red Size 7 Widget\",
\"Qty\": \"1\",
\"Amount\": \"100\"
}
]
}"
Seven Stars

Re: How to call json data from http(s) in tRest or tRestclient component in Talend studio for DI

Hi,

Thanks a Lot Smiley Happy

It works fine.

I can get my output.

 

solved1.PNGoutput.PNG

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.