How to Create a POST Request with Body Parameters in Flask? or Flask: How to Properly Create a POST R

20 Replies, 1095 Views

If the body’s empty, it’s probably a headers issue. Make sure you’re sending the data as JSON in Postman/curl.

Btw, `request.form` is for form data, not JSON. Stick with `request.get_json()` for flask create post request with body parameters.

Here’s a curl example that worked for me:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' http://localhost:5000/submit
```

Messages In This Thread



Users browsing this thread: 1 Guest(s)