curl is a command-line tool that may be used to submit a HTTPS request to our REST API.
Leverage curl in your script or application through the use of bindings.
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:
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.
This section will construct a curl request for the Load Content endpoint.
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.
The above parameter adds an Authorization header and sets it to the REST API token through which this request will be authorized.
Append the following -H parameters:
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.
The above parameter defines the request body. In this case, the request body identifies
Append the following URL and replace 0001 with your customer account numberIdentifies a customer by a system-defined account number (e.g., 0001). This account number consists of alphanumeric characters. A customer's account number is displayed in the upper-right hand corner of the MCC..
The above URL identifies the endpoint that will be requested.
Verify that your curl request looks similar to the following:
Submit the curl request.
This section contains basic syntax information and a sample request.
This syntax will generate a silent response:
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:
The following sample syntax will generate a silent response for a purge request:
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/purge"
The properties of the above purge syntax are described below.
Syntax | Setting | Value |
---|---|---|
-X PUT |
HTTP Method |
PUT |
-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 |