[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