curl-example tagged requests and articles

Categorized request examples and articles tagged with [curl-example] 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 GET XML Example
An example of a Curl command to get and an XML data from the API endpoint. The Accept: application/xml request header tells the server that the client expects an XML response. The Content-Type: application/xml response header informs the client that the server returned an XML string.

Curl GET Example
An example of Curl GET request. In this Curl GET example, the HTTP GET method is specified with the -X GET command line parameter, and the target URL is passed as the last command line parameter. For this Curl GET example, the -X GET parameter is optional because Curl automatically selects the GET method unless the -X, --request, and -d command-line options are used.