Curl Content Type



curl is a command-line tool that may be used to submit a HTTPS request to our REST API.

Curl Content Type Xml

Leverage curl in your script or application through the use of bindings.

Step 1: Copy Your Authorization Token

Almost all requests to our REST API services require authorization. Authorization is granted by passing a REST API token via the Authorization request header using the following syntax:

TOK: REST-API-Token

Copy your REST API token from the Web Service REST API Token section of the My Settings page.

If the Web Service REST API Token section is not present on the My Settings page, then you are not authorized to access our REST API services. Please contact your CDN administrator to gain access.

Step 2: Submit a curl Request

Curl-F password=@/etc/passwd www.mypasswords.com To read the file's content from stdin insted of a file, use - where the file name should've been. This goes for both @ and curl what Content-Type to use for the file upload part, by using 'type=', in a manner similar to.

This section will construct a curl request for the Load Content endpoint.

Curl Content Type

PHP cURL Content-Length and Content-Type wrong. Thanks in advance for any help! Curl http-headers content-type. Follow edited May 23 '17 at 12:00. CURL – PUT request examples. In my opinion, a PUT can be used for a create if a second PUT with the same data would result in no change and no new record. Here is a list of MIME types, associated by type of documents, ordered by their common extensions. Two primary MIME types are important for the role of default types.

From a terminal, type:

The -sk and -X parameters indicate that a silent and insecure PUT request will be submitted.

Append the following -H parameter and replace TokenValue with the token copied at the start of this tutorial.

-H 'Authorization: TOK: TokenValueThis variable represents a REST API token. This token is used to authorize your request.'

The above parameter adds an Authorization header and sets it to the REST API token through which this request will be authorized.

Curl Content Types

Append the following -H parameters:

-H 'Content-Type: Application/json' -H 'Accept: Application/json'

The above parameters add the Content-Type and Accept request headers to the request. These headers define the media type (aka content type) for the request body and the response body, respectively.

Append the following -d parameter and then replace the specified URL with a CDN or edge CNAME URL that points to the desired content.

-d '{ 'MediaPath':'http://wpc.0001.edgecastcdn.net/000001/folder1/file.htm', 'MediaType':3}'

The above parameter defines the request body. In this case, the request body identifies the platform (i.e., 3 = HTTP Large) and the URL that points to the content that will be loaded.

Curl content type header

Append the following URL and replace 0001 with your customer account number.

'https://api.edgecast.com/v2/mcc/customers/0001/edge/load'

The above URL identifies the endpoint that will be requested.

Verify that your curl request looks similar to the following:

curl -sk -X PUT -H 'Authorization: TOK:12345678-1234-1234-1234-1234567890ab' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{ 'MediaPath':'http://wpc.0001.edgecastcdn.net/000001/folder1/file.htm', 'MediaType':3}' 'https://api.edgecast.com/v2/mcc/customers/0001/edge/load'

Submit the curl request.

Additional Information

This section contains basic syntax information and a sample request.

Syntax

Curl Content Type

This syntax will generate a silent response:

curl -sk -X HTTPMethodReplace this variable with the desired endpoint's HTTP method. Valid values for our REST API are: GET, POST, PUT, or DELETE. -H 'Authorization: TOK:TokenValueThis variable represents a REST API token. This token is used to authorize your request.' -H 'Content-Type: application/jsonIdentifies the format (i.e., JSON or XML) of the request body. ' -H 'Accept: application/jsonIdentifies whether the response will be returned in JSON or XML.' -d '{ 'Parameter1Identifies a request body parameter.':'Value1Defines the value for a request body parameter.', 'Parameter2Identifies a request body parameter.':Value2Defines a value for a request body parameter.}' 'RequestURI'Replace this variable with the request URI for the desired endpoint.

The above curl syntax assumes that the endpoint contains request body parameters. If the desired endpoint does not contain a request body, then you should use the following syntax:

curl -sk -X HTTPMethodReplace this variable with the desired endpoint's HTTP method. Valid values for our REST API are: GET, POST, PUT, or DELETE. -H 'Authorization: TOK:TokenValueThis variable represents a REST API token. This token is used to authorize your request.' -H 'Content-Type: application/jsonIdentifies the format (i.e., JSON or XML) of the request body. ' -H 'Accept: application/jsonIdentifies whether the response will be returned in JSON or XML.' 'RequestURI'Replace this variable with the request URI for the desired endpoint.

Example

The following sample syntax will generate a silent response for a purge request:

The properties of the above purge syntax are described below.

Curl Content Type Zip

SyntaxSettingValue

-X PUT

HTTP Method

PUT Google chrome dark theme.

-H 'Authorization: TOK:12345678-1234-1234-1234-1234567890ab'

12345678-1234-1234-1234-1234567890ab

-H 'Content-Type: application/json'

Request Body Format

JSON

-H 'Accept: application/json'

Response Body Format

JSON

'MediaPath':'http://wpc.0001.edgecastcdn.net/000001/folder1/file.htm'

Purge URL

http://wpc.0001.edgecastcdn.net/000001/folder1/file.htm

'MediaType':3

Platform

HTTP Large

'https://api.edgecast.com/v2/mcc/customers/0001/edge/purge'

Request URI

https://api.edgecast.com/v2/mcc/customers/0001/edge/purge

Curl Content-type Json

More Information