curl-post tagged requests and articles

Categorized request examples and articles tagged with [curl-post] keyword
How do I POST JSON with Curl?
To post JSON data using Curl, you need to set the Content-Type of your request to application/json. This is done using the -H "Content-Type: application/json" command line parameter. JSON data is passed with the curl -d command line option. Double quotes in JSON are escaped with \". Click Run to execute Curl POST JSON example online and see results.

Curl POST Form Example
An example of a Curl command to post a form in a URL-encoded format. The form data is passed as key/value pairs with -d curl command-line parameter. The Content-Type header application/x-www-form-urlencoded specifies the media type of the resource as urlencoded form data.

Curl POST XML Example
An example of a Curl command to post an XML string to the API endpoint. In this post XML request example, the 'Content-Type: application/xml' request header indicates that the request body contains an XML. The 'Accept: application/xml' request header tells the server that the client expects an XML. The XML is passed in the Curl -d command-line parameter.

Curl POST With Basic Authentication
An example of making a POST request with basic authentication credentials using Curl. The basic authentication credentials are passed with the --user "login:password" command-line parameter. The POST data are passed with the -d parameter.

Curl Content Type
An example of making a POST request using Curl with a custom content type header. The -H "Content-Type: application/json" command line option specifies the media type of the resource in the request body. You can use your own mime type here. Data is passed to Curl using the -d command line option. They must match the provided content type.