'error in posting file and some key values using CURL

I have an REST API in django which takes some key values as well as an image. I tried to do a POST using the following command and I get the following error:

$ curl -v -F site=ABC -F key1=3 -F key2=1 -F key3=5 -F key4=4 -F [email protected] http://127.0.0.1:8000/api/products/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
> POST /api/products/ HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Length: 59318
> Content-Type: multipart/form-data; boundary=------------------------485e8d02d7d0b9fb
> Expect: 100-continue
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 400 Bad Request
< Date: Wed, 02 Feb 2022 21:18:02 GMT
< Server: WSGIServer/0.2 CPython/3.8.0
< Content-Type: application/json
< Vary: Accept, Origin, Cookie
< Allow: GET, POST, HEAD, OPTIONS
< X-Frame-Options: DENY
< Content-Length: 36
< X-Content-Type-Options: nosniff
< Referrer-Policy: same-origin
< Cross-Origin-Opener-Policy: same-origin
* HTTP error before end of send, stop sending
< 
* Closing connection 0

Not sure what is the issue here, any idea what it is and how to solve it? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source