JSON with REST API

Highlighted
Five Stars

JSON with REST API

Hi Everyone/ @evansdar,

 

I need to send data from a JSON file from Talend with REST API.
To verify that my file and my POST URL is working, I did the test on Postman without error, it allows to create new object in my tools.

 

I need this working on  Talend, But unfortunately it is failing due to the below error

 

Here the contents of my JSON file:

 

----------------

{"master":[
   {
      
"startDateTime": {
"value": "2019-08-01T08%3A00%3A00"
},
"endDateTime": {
"value": "2019-08-31T16%3A59%3A59"
},
"serviceId": "2702"
 
   }
   ]}
 
--------------------
 
The json is valid but we are getting an error
 
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<StatusCode>400</StatusCode>
<StatusText>Invalid JSON : Expected BEGIN_OBJECT but was STRING at line 1 column 2 path $</StatusText>
<InfoText></InfoText>
</Error>|400
 
 
Please suggest.
 
 

 

 

 

 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: JSON with REST API

Your body contains the String " row6.content" (probably not what you expect).

Should be (String)globalMap.get("row6.content") if tFlowToIterate_1 use default settings.


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: JSON with REST API

Something with your tREST component?

Can your share its settings?

 


TRF
Five Stars

Re: JSON with REST API

Hi TRF,

 

Attached is the screenshot.

 

Thanks,

Mahesh

 

 

Fifteen Stars TRF
Fifteen Stars

Re: JSON with REST API

Your body contains the String " row6.content" (probably not what you expect).

Should be (String)globalMap.get("row6.content") if tFlowToIterate_1 use default settings.


TRF
Five Stars

Re: JSON with REST API

I tried like this as you mentioned , but still throws an error.

 

 

 

 

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 4

Pick up some tips and tricks with Context Variables

Blog

Talend Studio Improvements for API Services

Taken a look at the Talend Studio improvements for API Services

Watch Now

Data Integration Success Stories

Take a look at some Data Integration success stories

Read