deliveryserviceserver

GET

Retrieve information about the assignment of servers to Delivery Services

Auth. Required:

Yes

Roles Required:

None[1]

Permissions Required:

SERVER:READ, DELIVERY-SERVICE:READ

Response Type:

Array

Request Structure

Table 342 Request Query Parameters

Name

Required

Default

Description

cdn

no

None

Limit the results to delivery service servers for the given CDN name

page

no

0

The page number for use in pagination - 0 means “no pagination”

limit

no

20

Limits the results to a maximum of this number - if pagination is used, this defines the number of results per page

orderby

no

“deliveryService”

Choose the ordering of the results - the value must either be the name of one of the fields of the objects in the response array or be empty to skip ordering altogether

#803 Request Example
GET /api/4.0/deliveryserviceserver?page=1&limit=2&orderby=lastUpdated HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...

Response Structure

Unlike most API endpoints, this will return a JSON response body containing both a “response” object as well as other, top-level fields (besides the optional “alerts” field). For this reason, this section contains a “response” key, which normally is implicit.

limit:

The maximum size of the response array, also indicative of the number of results per page using the pagination requested by the query parameters (if any) - this should be the same as the limit query parameter (if given)

orderby:

A string that names the field by which the elements of the response array are ordered - should be the same as the orderby request query parameter (if given)

response:

An array of objects, each of which represents a server’s Delivery Service assignment

deliveryService:

The integral, unique identifier of the Delivery Service to which the server identified by server is assigned

lastUpdated:

The date and time at which the server’s assignment to a Delivery Service was last updated, in Traffic Ops’s Custom Date/Time Format

server:

The integral, unique identifier of a server which is assigned to the Delivery Service identified by deliveryService

size:

The page number - if pagination was requested in the query parameters, else 0 to indicate no pagination - of the results represented by the response array. This is named “size” for legacy reasons

#804 Response Example
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: J7sK8PohQWyTpTrMjjrWdlJwPj+Zyep/xutM25uVosL6cHgi30nXa6VMyOC5Y3vd9r5KLES8rTgR+qUQcZcJ/A==
X-Server-Name: traffic_ops_golang/
Date: Thu, 01 Nov 2018 14:27:45 GMT
Content-Length: 129

{ "orderby": "lastUpdated",
"response": [
    {
        "server": 8,
        "deliveryService": 1,
        "lastUpdated": "2018-11-01 14:10:38+00"
    }
],
"size": 1,
"limit": 2
}

POST

Assign a set of one or more servers to a Delivery Service

Auth. Required:

Yes

Roles Required:

“admin” or “operations”[2]

Permissions Required:

DELIVERY-SERVICE:READ, SERVER:READ, SERVER:UPDATE, DELIVERY-SERVICE:UPDATE

Response Type:

Object

Request Structure

dsId:

The integral, unique identifier of the Delivery Service to which the servers identified in the servers array will be assigned

replace:

If true, any existing assignments for a server identified in the servers array will be overwritten by this request

servers:

An array of integral, unique identifiers for servers which are to be assigned to the Delivery Service identified by deliveryService

#805 Request Example
POST /api/4.0/deliveryserviceserver HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 46
Content-Type: application/x-www-form-urlencoded

dsId=1&replace=true&servers=12

Response Structure

dsId:

The integral, unique identifier of the Delivery Service to which the servers identified by the elements of the servers array have been assigned

replace:

If true, any existing assignments for a server identified in the servers array have been overwritten by this request

servers:

An array of integral, unique identifiers for servers which have been assigned to the Delivery Service identified by deliveryService

#806 Response Example
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Type: application/json
Set-Cookie: mojolicious=...; Path=/; Expires=Mon, 18 Nov 2019 17:40:54 GMT; Max-Age=3600; HttpOnly
Whole-Content-Sha512: D+HhGhoxzaxvka9vZIStoaOZUpX23nz7zZnMbpFHNRO3MawyEaSb3GVUHQyCv6sDgwhpZZjRggDmctGCw88flg==
X-Server-Name: traffic_ops_golang/
Date: Thu, 01 Nov 2018 14:12:49 GMT
Content-Length: 123

{ "alerts": [
    {
        "text": "server assignements complete",
        "level": "success"
    }
],
"response": {
    "dsId": 1,
    "replace": false,
    "servers": [ 12 ]
}}