Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

send json data via REST request on talend

hi evryone , i want to send data to my elasticsearch database. for that I recover my data from an oracle database I transform them into json and send them via a REST request on talend

I use elasticsearch versions 7.0.1 and talend 7.1.1

data send :

{"name": "Fabrice", "site": "Paris", "department": "North West"}

method Post in this url : "http://localhost:9200/myIndex"

i have this error :

exception in component tRESTClient_1 (DataOracleToJson)
javax.ws.rs.WebApplicationException: HTTP 400 Bad Request

 0683p000009M4C9.png

Labels (7)
11 Replies
vapukov
Master II
Master II

Hi,

 

you put "Content-Type" and "Accept" into the wrong place

if you want to use them (it will work and without) - use Advanced settings headers section

0683p000009M4E0.png

 

 

add:

 

one more:

  • URL
  • and Relative path

both parts of the full address:

URL - http://localhost:9200

Relative path - /myindex/_doc

Anonymous
Not applicable
Author

 

thank you for your answer, I remove but still the same problem :

Exception in component tRESTClient_1 (DataOracleToJson)
javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
	at local_projectoracle_to_json.dataoracletojson_0_1.DataOracleToJson.tWriteJSONField_2_InProcess(DataOracleToJson.java:2621)
	at local_projectoracle_to_json.dataoracletojson_0_1.DataOracleToJson$1ThreadXMLField_tWriteJSONField_2_Out.run(DataOracleToJson.java:930)

 

yet if I run the query with curl it works

 

curl -XPOST "http://localhost:9200/myIndex/_doc" -H 'Content-Type: application/json' -d' {"name": "Fabrice", "site": "Paris", "department": "North West"}'

 

 

vapukov
Master II
Master II

please see add part of answer

Anonymous
Not applicable
Author

0683p000009M4E5.png0683p000009M4EA.png0683p000009M46Z.png

vapukov
Master II
Master II

I mean - see "add" section in my answer 🙂

your address is duplicate each other, but it really - 2 parts of the same address

 

also - good to add some connection to response and error flows from tRESTClient 

both parts of the full address:
URL - http://localhost:9200
Relative path - /myindex/_doc
Anonymous
Not applicable
Author

thanks for your answer, i edit but there is always the same error HTTP 400 Bad Request, I look with wireshark, the request is send but the json object is not send

vapukov
Master II
Master II

Hi,

 

there need to check all chain - what and how you prepare, types, column name

 

in my case, I use a single tXMLMap instead of tMap + tWriteJSON and populate column body (type document)

everything work

Anonymous
Not applicable
Author

I put the tXMLMap and I checked all the chain I see the object json go until tRestClient, everything seems ok. I think the problem comes from the configuration of the tRestClient, how to fill the body of the column (document type)

Anonymous
Not applicable
Author

with curl :

0683p000009M4Kd.pngWith curl

with talend:

0683p000009M43I.pngWith talend