Skip to content

Latest commit

 

History

History
246 lines (212 loc) · 8.42 KB

profiles_name_name_parameters.rst

File metadata and controls

246 lines (212 loc) · 8.42 KB

profiles/name/{{name}}/parameters

GET

Retrieves all Parameters associated with a given Profile

Auth. Required

Yes

Roles Required

None

Response Type

None

Request Structure

Request Path Parameters
Name Description
name The profile-name of the Profile for which Parameters will be listed
GET /api/3.0/profiles/name/GLOBAL/parameters HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...

Response Structure

configFile

The Parameter's parameter-config-file

id

The Parameter's parameter-id

lastUpdated

The date and time at which this Parameter was last updated, in non-rfc-datetime

name

parameter-name of the Parameter

profiles

An array of Profile Names <profile-name> that use this Parameter

secure

A boolean value that describes whether or not the Parameter is parameter-secure

value

The Parameter's parameter-value

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: NudgZXUNyKNpmSFf856KEjyy+Pin/bFhG9NoRBDAxYbRKt2T5fF5Ze7sUNZfFI5n/ZZsgbx6Tsgtfd7oM6j+eg==
X-Server-Name: traffic_ops_golang/
Date: Wed, 05 Dec 2018 21:52:08 GMT
Content-Length: 542

{ "response": [
    {
        "configFile": "global",
        "id": 4,
        "lastUpdated": "2018-12-05 17:50:49+00",
        "name": "tm.instance_name",
        "secure": false,
        "value": "Traffic Ops CDN"
    },
    {
        "configFile": "global",
        "id": 5,
        "lastUpdated": "2018-12-05 17:50:49+00",
        "name": "tm.toolname",
        "secure": false,
        "value": "Traffic Ops"
    },
    {
        "configFile": "global",
        "id": 6,
        "lastUpdated": "2018-12-05 17:50:51+00",
        "name": "use_tenancy",
        "secure": false,
        "value": "1"
    },
    {
        "configFile": "regex_revalidate.config",
        "id": 7,
        "lastUpdated": "2018-12-05 17:50:49+00",
        "name": "maxRevalDurationDays",
        "secure": false,
        "value": "90"
    }
]}

POST

Associates Parameters to a Profile. If the Parameter does not exist, creates it and associates it to the Profile. If the Parameter already exists, associates it to the Profile. If the Parameter is already associated with the Profile, keep the association.

Auth. Required

Yes

Roles Required

"admin" or "operations"

Response Type

Object

Request Structure

Request Path Parameters
Name Description
name The profile-name of the Profile to which Parameters will be assigned

This endpoint accepts two formats for the request payload:

Single Parameter Format

Specify a single parameter to assign to the specified profile

Parameter Array Format

Specify multiple parameters to assign to the specified profile

Warning

Most API endpoints dealing with parameters treat secure as a boolean value, whereas this endpoint takes the legacy approach of treating it as an integer. Be careful when passing data back and forth, as boolean values will not be accepted by this endpoint!

Single Parameter Format

configFile

The Parameter's parameter-config-file

name

parameter-name of the Parameter

secure

A boolean value that describes whether or not the Parameter is parameter-secure

value

The Parameter's parameter-value

POST /api/3.0/profiles/name/test/parameters HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 99
Content-Type: application/json

{
    "name": "test",
    "configFile": "quest",
    "value": "A test parameter for API examples",
    "secure": 0
}

Parameter Array Format

configFile

The Parameter's parameter-config-file

name

parameter-name of the Parameter

secure

A boolean value that describes whether or not the Parameter is parameter-secure

value

The Parameter's parameter-value

POST /api/3.0/profiles/name/test/parameters HTTP/1.1
Host: trafficops.infra.ciab.test
User-Agent: curl/7.47.0
Accept: */*
Cookie: mojolicious=...
Content-Length: 212
Content-Type: application/json

[{
    "name": "test",
    "configFile": "quest",
    "value": "A test parameter for API examples",
    "secure": 0
},
{
    "name": "foo",
    "configFile": "bar",
    "value": "Another test parameter for API examples",
    "secure": 0
}]

Response Structure

parameters

An array of objects representing the Parameters which have been assigned

configFile

The Parameter's parameter-config-file

name

parameter-name of the Parameter

secure

A boolean value that describes whether or not the Parameter is parameter-secure

value

The Parameter's parameter-value

profileId

The profile-id of the Profile to which the Parameter(s) have been assigned

profileName

profile-name of the Profile to which the Parameter(s) have been assigned

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: HQWqOkoYHjvcxheWPrHOb0oZnUC+qLG1LO4OjtsLLnZYVUIu/qgJrzvziPnKq3FEHUWaZrnDCZM/iZD8AXOKBw==
X-Server-Name: traffic_ops_golang/
Date: Mon, 10 Dec 2018 14:20:22 GMT
Content-Length: 357

{ "alerts": [
    {
        "text": "Assign parameters successfully to profile test",
        "level": "success"
    }
],
"response": {
    "parameters": [
        {
            "configFile": "quest",
            "name": "test",
            "secure": 0,
            "value": "A test parameter for API examples",
            "id": 126
        },
        {
            "configFile": "bar",
            "name": "foo",
            "secure": 0,
            "value": "Another test parameter for API examples",
            "id": 129
        }
    ],
    "profileId": 18,
    "profileName": "test"
}}

Note

The format of the request does not affect the format of the response. parameters will be an array either way.