JSON with REST API

Highlighted
Six 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
Sixteen Stars TRF
Sixteen 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

View solution in original post


All Replies
Sixteen Stars TRF
Sixteen Stars

Re: JSON with REST API

Something with your tREST component?

Can your share its settings?

 


TRF
Six Stars

Re: JSON with REST API

Hi TRF,

 

Attached is the screenshot.

 

Thanks,

Mahesh

 

 

Sixteen Stars TRF
Sixteen 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

View solution in original post

Six 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 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

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog