Home > OS >  400 Bad Request API Json request
400 Bad Request API Json request

Time:06-13

I'm currently working on a Web API with Flask. The idea is that i get a Json File and i return one after the work is done.

The code is working (it worked before) but I'm currently getting this Error on Postman :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>Did not attempt to load JSON data because the request Content-Type was not &#x27;application/json&#x27;.</p>

and on the command line i get:

"POST /json HTTP/1.1" 400 -
code 400, message Bad request syntax ('{')
"None /json HTTP/0.9" HTTPStatus.BAD_REQUEST -.

Has anyone an idea what that means ?

CodePudding user response:

Make sure the api server is not problematic.

CodePudding user response:

The answer is in the response message. You made the api request without the appropriate Content-Type header. Just add it and it should work, if the api server has no other issues.

  • Related