Add Edge CNAME

Creates an edge CNAME.

Although This endpoint creates an edge CNAME, it will not add a CNAME record on a DNS server. This step must be performed before content can be requested through the new edge CNAME.

Request

A request to create an edge CNAME is described below.

HTTP Method Request URI

POST

https://api.transactcdn.com/v2/mcc/customers/AccountNumber/cnames

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 left-hand corner of the TCC.

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

DirPath

Required

String

Identifies a location on the origin server. This string should specify the relative path from the root folder of the origin server to the desired location.

Set this parameter to blank to point the edge CNAME to the root folder of the origin server.

EnableCustomReports

Integer

Determines whether hits and data transferred statistics will be tracked for this edge CNAME. Logged data can be viewed through the Custom Reports module.

Valid values are:

  • 0: Disabled (Default Value).
  • 1: Enabled. CDN activity on this edge CNAME will be logged.

MediaTypeId

Required

Integer

Identifies the platform on which the edge CNAME will be created.

The only valid value is:

  • 14: Commerce Acceleration Network (CAN) – (Includes SSL Traffic)

Name

Required

String

Sets the name that will be assigned to the edge CNAME. It should only contain lower-case alphanumeric characters, dashes, and periods.

The name specified for this parameter should also be defined as a CNAME record on a DNS server. The CNAME record defined on the DNS server should point to the CDN hostname (e.g., can.0001.transactcdn.com) for the platform identified by the MediaTypeId request parameter.

OriginId

Required

Integer

Identifies whether an edge CNAME will be created for a CDN origin server or a customer origin server.

Valid values are:

  • -1: Indicates that you would like to create an edge CNAME for our CDN storage service. This type of edge CNAME points to the root folder of a CDN origin server (e.g., /000001).
  • CustomerOriginID: Specifying an ID for an existing customer origin configuration indicates that you would like to create an edge CNAME for that customer origin. This type of edge CNAME points to the root folder of that customer origin server (e.g., /800001/CustomerOrigin).

Retrieve a list of customer origin IDs through the Get All Customer Origins endpoint.

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

CNameId

Integer

Indicates the ID assigned to the new edge CNAME.

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 shown below.

POST https://api.transactcdn.com/v2/mcc/customers/0001/cnames HTTP/1.1

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

Accept: application/json

Content-Type: application/json

Host:api.transactcdn.com

Content-Length: 99

{
	"DirPath" : "",
	"MediaTypeId" : 14,
	"Name" : "images.example.com",
	"OriginId" : -1
}
		

A sample JSON response is shown 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: 25

{
	"CNameId" : 123456
}

Sample Request and Response (XML)

A sample XML request is shown below.

POST https://api.transactcdn.com/v2/mcc/customers/0001/cnames HTTP/1.1

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

Accept: application/xml

Content-Type: application/xml

Host:api.transactcdn.com

Content-Length: 230

<CustomerCnameParameter xmlns="http://www.whitecdn.com/schemas/apiservices/">
	<DirPath/>
	<MediaTypeId>14</MediaTypeId>
	<Name>images.example.com</Name>
	<OriginId>-1</OriginId>
</CustomerCnameParameter>		

A sample XML response is shown below.

HTTP/1.1 200 OK

Cache-Control: private

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

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

Content-Length: 178

<CustomerCnameAddResult xmlns="http://www.whitecdn.com/schemas/apiservices/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<CNameId>123456</CNameId>
</CustomerCnameAddResult>