Add Token-Based Authentication Directory

Adds a platform-specific location for which content delivery will require authentication. Keep in mind that Token-Based Authentication is applied recursively to each authentication directory. A valid token must be included in the request URL for all assets within a folder branch of an authentication directory.

It may take up to an hour for this change to take effect.

Request

A request to add an authentication directory is described below.

HTTP Method Request URI

POST

https://api.edgecast.com/v2/mcc/customers/AccountNumber/token/directories

Define the following variable when submitting the above request.

VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3). Description

AccountNumber

Required

Replace this variable with a customer account number. This account number may be found in the upper right-hand corner of the MCC.

Request Headers

This endpointIdentifies a request's connection point to our REST API service. only takes advantage of common request headers.

Request Body

Pass the following request body parameters:

Name Data Type Description

Directory

Required

String

Indicates the relative path to the desired directory. The starting point for this relative path varies according to the origin server type.

  • CDN Origin Server: The root folder for your CDN storage account can be specified using a forward slash (i.e., /). If you would like to specify a different folder, simply append the relative path to that folder (e.g., /Sales/Presentations).
  • Customer Origin Server: The root folder for your customer origin server can be specified by typing a forward slash, the name of your customer origin server, and then another forward slash (e.g., /MyCustomerOrigin/). If you would like to specify a different folder, simply append the relative path to that folder (e.g., /MyCustomerOrigin/Sales/Presentations).

This configuration will only add an authentication directory to the platform specified by the MediaType parameter. Please make sure to set up Token-Based Authentication on other platforms to ensure that the content in question requires authentication.

MediaTypeId

Required

Integer

Indicates the service on which a new authentication directory will be defined. It should be replaced with the ID associated with the desired service.

Valid values are:

  • 3: HTTP Large
  • 8: HTTP Small
  • 14: Application Delivery Network (ADN)

Response

The response to the above request includes an HTTP status code, response headers, and a response body.

Status Code

A status code indicates whether the request was successfully performed.

Response Headers

The response for this endpoint only includes standard HTTP response headers.

View common response headers.

Response Body

The response body for a successful request contains the following response parameter:

Name Data Type Description

Id

Integer

Indicates the unique ID assigned to the new authentication directory.

Errors

The response body for an unsuccessful request may contain an error parameter that provides additional information.

View common error messages.

Sample Request and Response (JSON)

A sample JSON request is provided below.

POST https://api.edgecast.com/v2/mcc/customers/0001/token/directories HTTP/1.1

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

Accept: application/json

Content-Type: application/json

Host:api.edgecast.com

Content-Length: 71

{
	"Directory" : "\/MyCustomerOrigin\/Presentations",
	"MediaType" : 3
}		

A sample JSON response is provided below.

HTTP/1.1 200 OK

Cache-Control: private

Content-Type: application/json; charset=utf-8

Date: Thu, 15 Apr 2021 12:00:00 GMT

Content-Length: 14

{
	"Id" : 123
}

Sample Request and Response (XML)

A sample XML request is provided below.

POST https://api.edgecast.com/v2/mcc/customers/0001/token/directories HTTP/1.1

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

Accept: application/xml

Content-Type: application/xml

Host:api.edgecast.com

Content-Length: 180

<CustomerTokenDirectoriesAPI xmlns="http://www.whitecdn.com/schemas/apiservices/">
	<Directory>/MyCustomerOrigin/Presentations</Directory>
	<MediaTypeId>3</MediaTypeId>
</CustomerTokenDirectoriesAPI>

A sample XML response is provided below.

HTTP/1.1 200 OK

Cache-Control: private

Content-Type: application/json; charset=utf-8

Date: Thu, 15 Apr 2021 12:00:00 GMT

Content-Length: 207

<CustomerTokenDirectoriesAPICreateResult xmlns="http://www.whitecdn.com/schemas/apiservices/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Id>123</Id>
</CustomerTokenDirectoriesAPICreateResult>