I am using a curl command with POST method using html Form with attribute- values. I am using flask framework. My content type is not application-json.
The command I give with the headers is as follows:
curl -b cookies.txt -F "description=description" -F "file_name=@curl_commands.md" -X POST http://localhost:5000/api/v1.0/upload_doc
-H 'workflow_id:1' -H 'change_workflow:Y'
What should I specify for the Content-type:? This is required for the js ajax call.
Curl Content-Type Syntax Where: -H, —header: the HTTP header with which contains the data type for the data in the request body. d, —data: data to send to server using POST, PUT, or PATCH request.
When the -F option is used, curl sends the data using the multipart/form-data Content-Type. Another way to make a POST request is to use the -d option. This causes curl to send the data using the application/x-www-form-urlencoded Content-Type.
Content-Type in HTML forms In a POST request, resulting from an HTML form submission, the Content-Type of the request is specified by the enctype attribute on the <form> element.
Updated February 23, 2021 | Published April 4, 2019. cURL, which stands for client URL, is a command line tool that developers use to transfer data to and from a server. At the most fundamental, cURL lets you talk to a server by specifying the location (in the form of a URL) and the data you want to send.
The answer is clear at this url: application/x-www-form-urlencoded
or multipart/form-data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With