Typical Usage in the Traffic Manager

This chapter describes the usage, syntax, and structure of the Traffic Manager REST API.

The Resource Model

The Traffic Manager REST API is made up of a hierarchy of resources that are manipulated using standard HTTP calls to a listener service running along side the Traffic Manager. HTTP URIs are used to address the resources in the system.

There are three resource types:

Configuration: to represent Traffic Manager configuration objects.

Counters: for reporting through SNMP counters.

Information: for system information.

Counters and Information resources are read-only, whereas Configuration resources are fully interactive and map directly to the native Traffic Manager configuration system. Each concept, such as pools, virtual servers, TrafficScript rules, or Service Level Monitoring classes, has an associated configuration resource model.

All resources are represented as JSON structures (MIME type application/json), and objects of each resource type are captured in this format.

Typically, a configuration resource follows this format:

{

"properties": {

"sectionname": {

"key1": "stringvalue1",

"key2": numericvalue2,

"key3": booleanvalue3

}

}

}

A single instance of a resource, for example a virtual server, contains a primary group entitled "properties". This contains all configuration keys attributable to this resource type.

Counter resources contain dynamically generated data to correspond to SNMP counters in the Traffic Manager.

Sections

Sections are designed to contain properties (or "keys") that have a commonality of purpose or perhaps apply in certain circumstances. For example, monitor classes may have keys that apply only to monitors of particular types.

In a configuration resource, the properties group contains several sections, one for each logical set of keys. There is always a section entitled "basic," containing common configuration items, followed by one or more additional sections according to the specification of the resource.

A counter resource contains a single section, "statistics," listing the SNMP counters associated with the resource. Similarly, an information resource contains a single section, "information," listing the system information properties applicable to this Traffic Manager.

Data Types

Each key:value pair is then presented as a comma-separated list within each section, according to the specification shown throughout this guide. Key names are always delimited by quotes, with the values according to the following rules:

Type

Value

Boolean

A value of true or false (case-sensitive).

For example:

"key1": true,

"key2": false

Int

A numeric positive or negative value with no decimal point.

For example:

"key1": 1024,

"key2": -10

Unsigned Int

A numeric positive value with no decimal point.

For example:

"key1": 0,

"key2": 50

Float

A numeric positive or negative value that can have a decimal point.

For example:

"key1": 1.0,

"key2": -1024.111

String

A set of alpha-numeric characters that may not include new-lines. Non-alpha characters must use correct character escapes.

For example:

"key1": "Hello world",

"key2": "",

"key3": "Hello y\’all"

Freeform String

A set of alpha-numeric characters that can contain new-lines. Non-alpha characters must use correct character escapes, and a newline must be represented by a \n.

For example:

"key1": "Multi-line\nString",

Password

A string that cannot be read, only written to. When read, it is displayed as a structure that indicates if the password has been set (is non-empty).

For example, when reading the key:

"key1": { "password_set": false },

"key2": { "password_set": true }

When writing to the key, the structure can be unchanged, or a new password can be set:

"key2": { "password_set": true },

"key1": "secret123"

Time

Times are represented as strings in ISO8601 time format, including a time zone designator.

For example:

{Year}-{Month}-{Day}T{Hour}:{Minute}:{Second}{Time Zone}

Set

This is a collection of unique unordered items of a particular type, stored as an array.

For consistency, a set is rendered in alpha-numeric order.

For example:

"key": [ "Item A", "Item B", "Item D" ]

List

This is a collection of ordered items of a particular type. It may contain duplicates and is stored as a standard array.

For example:

"key": [ "Item A", "Item C", "Item A" ]

Tables

This is a special type designed to allow nested data within a single config key. In some circumstances, you might wish to specify a list or array of data items, such as a list of pool nodes, where each item has one or more extra pieces of configuration data to be attached to it.

Each one of these nested list entries expects a value known as the “primary key”, used to identify it. Each sub-key value should then be specified in the same way.

For example:

"key": [

{

"prmkey": "Hello World",

"subkey1": false,

"subkey2": [ "Item 1", "Item 2" ]

},

{

"prmkey": "Other text",

"subkey1": true,

"subkey2": []

},

]