[resolved] JSON with HTTP POST

One Star

[resolved] JSON with HTTP POST

Hello,
newly I have heard of the JSON Script. Now I should do a JSON request over HTTP POST.
I have tried tHTTPRequest, tRest but without any success.
With tHTTPRequest I get the answer from the Server "415 Unsupported Media Type" that is way I am thinkg I do have the wrong syntax.
The Server just need my login data, like
"AuthenticationTO:
{
"username":"XXXXXX@XXX",
"password":"XXXXXXXXXXX"
}"
and it should give me data in JSON back.
Can someone please show me how to configure tHTTPRequest or which Job ever is best for it.
Hope this is understandable. Feel free to ask.
Regards,
Franzi

Accepted Solutions
One Star

Re: [resolved] JSON with HTTP POST

Finally I found the problems.
1. what archenroot had allready said
custom header with tHttpRequest:
header value
Content-type application/json
2. wrong json file
the file content should looks like:
{
"username":"xxx",
"password":"xxx"
}
then it works.
Regrads Franzi

All Replies
Six Stars

Re: [resolved] JSON with HTTP POST

Try to configure custom header with tHttpRequest:
header          value
Content-type application/json
One Star

Re: [resolved] JSON with HTTP POST

Hello archenroot,
thanks for your response, not sure if I understand you right. Because I just get even more errors.
My tHttpRequest looks like the following (some issues just circumscribed do to corporate secret)
Property: Built-In
URI: URL from where to get the data
Method: POST
Post parameters from file: ".../authentification.json" (do not know what to do with it, or better how this file should looks like)
"tick" Write response content to file: ".../response.json" (empty file)
Headers: value:
Content-type application/json
"untick" Need authentification (tried to get the authentification data via the file)
- have also tried it tick and without an file, but that also does not work

Authentification file:
{
"username":"xxx",
"password":"xxx"
}

What am I doing wrong?
Greetings Franzi
One Star

Re: [resolved] JSON with HTTP POST

Finally I found the problems.
1. what archenroot had allready said
custom header with tHttpRequest:
header value
Content-type application/json
2. wrong json file
the file content should looks like:
{
"username":"xxx",
"password":"xxx"
}
then it works.
Regrads Franzi

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch