curl tagged requests and articles

Categorized request examples and articles tagged with [curl] keyword
Curl Request With Bearer Token Authorization Header
An example of a Curl request with Bearer Token Authorization header. The bearer token is sent to the server in the 'Authorization: Bearer {token}' authorization header. The 'Accept: application/json' header tells the server that the client expects a JSON. The server informs the client that it returned a JSON with 'Content-Type: application/json' response header.
curl get-request bearer-token authorization authorization-header request-header

Get URL with Curl
Curl command to send a GET request to an URL to retrieve the page's body and HTTP headers. The 'Accept: */*' request header is added automatically by Curl. The server informs the client that the response body contains an HTML with 'Content-Type: text/html' response header.
curl get-html get-url get-request

Curl POST JSON Example
An example of a Curl command to post a JSON string to the REST API endpoint. The 'Content-Type: application/json' request header indicates the media type of the resource in the request body. The 'Accept: application/json' request header tells the server that the client expects a JSON media type. The JSON is passed in the -d command-line parameter.
curl json post-json post-request rest-api request-header

Curl Command to POST a Form
An example of a Curl command to post a form to the target URL. The 'Content-Type: application/x-www-form-urlencoded' request header indicates that the form data is encoded in the URL-encoded format. The Curl -d command line parameter contains the data to send.
curl post-request post-form submit-form urlencoded form

Curl Command to GET a JSON String
An example of a Curl command to get a JSON string from the REST API endpoint. The 'Accept: application/json' request header is passed to the server with the Curl -H command-line parameter and tells the server that the client expects JSON media type.
curl json get-json get-request rest-api request-header

Curl Command to POST an XML String
An example of a Curl command to post an XML string to the API endpoint. 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-request post-xml xml soap-api request-header

Curl Command With Basic Server Authentication Header
An example of a Curl command with the basic server authentication credentials in the request header. For the basic server authentication, the 'Authorization: Basic {credentials}' header is added to the request. Where the {credentials} is a Base64 encoded string of login and password pair joined by a single colon :.
curl basic-authentication server-authentication get-request authorization

OPTIONS Request with Curl
This page shows how to send an OPTIONS request with Curl. Browsers send OPTIONS requests when making a CORS request to another origin.
curl cors options-request options-method options

Curl Command With Close Connection Header
This page shows how to send a Curl request to the server and indicate that the client doesn't want to keep the connection open by sending 'Connection: close' header.
curl head-request head-method connection-header connection-close

Curl Command to GET an XML String
An example of a Curl command to get and an XML string from the API endpoint. The 'Accept: application/xml' request header tells the server that the client expects an XML. The 'Content-Type: application/xml' response header informs the client that the server returned an XML string.
curl xml get-request get-xml soap-api request-header

Send Custom Headers with Curl
This page shows how to send a Curl command with custom request headers.
curl get-request custom-header request-header

Curl Command With Keep-Alive Connection Header
An example of a Curl request sent to the server to establish a persistent connection with the Connection and Keep-Alive headers. Try it with ReqBin Curl online.
curl connection-header head-request keep-alive request-header

Send CORS Request with Credentials with Curl
This page demonstrates a Curl command to send a CORS request with the Origin header and HTTP cookies (Cross-Origin Resource Sharing request).
curl cors origin-header cookies credentials authorization

Curl Command with CORS Headers
This page shows how to send a Curl request with CORS Origin header (Cross-Origin Resource Sharing request).
curl cors get-request request-header get-method

Curl PATCH JSON String
An example of a Curl command for sending a PATCH request with JSON content string to the REST API endpoint. Try it yourself with ReqBin online Curl Client.
curl json patch-request path-method rest-api submit-data

Curl PUT JSON Example
An example of Curl command for updating a resource on the server by sending a PUT request with JSON string to the REST API endpoint.
curl json put-request rest-api put-method submit-data

Curl Command with HTTP Headers to Prevent Caching
An example of Curl command with HTTP headers to prevent caching that works across all servers and proxies.
curl caching prevent-caching request-header get-request get-method

DELETE Request Curl Example
An example of how to send a Curl command with DELETE request to the REST API endpoint.
curl delete-request delete-method rest-api

Curl Command with Cookies in Header
This page shows how to send a Curl request with HTTP cookies in the request header.
curl cookies get-request request-header get-method

Curl Command to POST JSON String with Bearer Token Authorization Header
This page shows how to send a JSON string with a Bearer token authorization header with Curl.
curl json post-request bearer-token authorization authorization-header post-json request-header

POST JSON with Curl
An example of a Curl request to post a JSON string to the REST API endpoint. The 'Content-Type: application/json' request header indicates the media type of the resource in the request body. The 'Accept: application/json' request header tells the server that the client expects a JSON. The JSON string is passed in the Curl -d command-line parameter.
curl json post-request request-header rest-api post-json

Curl Command for TRACE
Testing for HTTP TRACE method
curl http-method trace-request trace-method

Curl Command to POST JSON String With Basic Authentication
This page shows how to send a JSON string with Basic authentication header with Curl.
curl json basic-authentication authentication-header request-header authorization rest-api

Curl GET JSON Example
This page shows how to send a Curl command to get JSON from the server.
curl json get-request get-json rest-api get-method request-header

Curl REST API GET Example
An example of a Curl command for sending a GET request to the REST API endpoint to get a JSON. Try it yourself with ReqBin online Curl Client.
curl json get-request request-header rest-api

Curl POST Form
An example of POST-ing a form with Curl with 'Content-Type: application/x-www-form-urlencoded' HTTP header. Try it yourself with ReqBin online Curl client.
curl post-form post-request urlencoded request-header post-method

curl -d
A live example of the Curl command for sending data in POST request with the correct HTTP header. Try it yourself with ReqBin online Curl client.
curl post-form post-request request-header urlencoded curl-command post-method submit-data http-header

Posting JSON to the Server with Curl
Curl command for posting JSON data to the server as a part of the request. The 'Content-Type: application/json' header indicates that we are sending a JSON. The 'Accept: application/json' header tells the server that we can accept JSON.
curl json post-request request-header rest-api post-json

Convert Curl to HTTP GET Request
Convert Curl command to the HTTP GET request. See the GET Header and body on the Raw tab.
curl get-method get-request rest-api

Curl with Authorization Header Example
This page shows how to send a Curl request with Bearer Token authorization header.
curl authorization-header request-header bearer-token

POST JSON with Curl Example
This page shows how to send a Curl command with JSON string
curl json post-request request-header post-json rest-api

OPTIONS Request by Curl
An Example of Sending OPTIONS Request with Curl
curl options-request origin-header request-header http-headers options-method

curl -u
A live example of sending Curl command with Basic server authentication header (credentials are provided with -u or --user command-line argument). Try it yourself with ReqBin online Curl client.
basic-authentication http-header curl json authorization request-header curl-command

Curl POST Request
An example of making a POST request with Curl. The '-H "Content-Type: application/json"' Curl command-line parameter indicates the media type of the resource. The '-d "{...}"' command-line parameter contains the data to send to the server. The 'Accept: application/json' request header informs the server that Curl client expects a JSON.
curl json post-data post-request request-header

Curl GET Request
An example of making a GET request with Curl. The '-H "Accept: application/json"' Curl command-line parameter appends 'Accept: application/json' request header and informs the server that Curl client expects a JSON. The 'Content-Type: application/json' response header informs the Curl client that the server returned a JSON string.
curl get-request request-header

Convert Curl to POST JSON Request
Convert Curl command to the HTTP POST JSON request. See the POST Header and JSON on the Raw tab.
curl json rest-api post-request post-method

GET JSON with Curl
This is a live example of retrieving a JSON string from a REST API endpoint using Curl. Try it yourself with ReqBin online Curl client.
curl json get-request rest-api request-header

Curl Header
An example of a sending header with Curl. The '-H "Accept: application/json"' Curl command-line parameter appends 'Accept: application/json' header to the request and informs the server that the Curl client expects a JSON. The "Content-Type: application/json" Curl header indicates the resource type in the request body.
curl request-header post-request

Convert Curl to HTTP POST Request
Convert Curl command to the HTTP POST request. See the POST Header and body on the Raw tab.
curl post-method rest-api post-request json