Environment Variables

This chapter focuses on environment variables.

get Get all environment variables

A GET to /environment-variables returns all environment variables.

HTTP request

GET /api/rest/latest/environment-variables?page=0&size=20 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

type

which type of the element should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 864

{
  "_embedded" : {
    "environment-variables" : [ {
      "_type" : "environment-variable",
      "id" : 1,
      "name" : "Vivaldi",
      "options" : [ ],
      "input_type" : "PLAIN_TEXT",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/environment-variables/1"
        }
      }
    }, {
      "_type" : "environment-variable",
      "id" : 2,
      "name" : "Brave",
      "options" : [ ],
      "input_type" : "PLAIN_TEXT",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/environment-variables/2"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/environment-variables?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}

Response fields

Path Type Description

_embedded.environment-variables

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

get Get environment variable

A GET to /environment-variables/{id} returns the environment variable with the given ID.

Path parameters

Table 1. /api/rest/latest/environment-variables/{id}
Parameter Description

id

the id of the environment-variable

HTTP request

GET /api/rest/latest/environment-variables/3 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 239

{
  "_type" : "environment-variable",
  "id" : 3,
  "name" : "Edge",
  "options" : [ ],
  "input_type" : "PLAIN_TEXT",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/environment-variables/3"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the entity

_type

String

the type of the entity

name

String

name of the environment-variable

input_type

String

the type of environment-variable

options

Array

all the options of the environment-variable

_links

Object

related links

Relation Description

self

link to this environment-variable

post Create environment variable

A POST to /environment-variables creates a new environment variable.

HTTP request

POST /api/rest/latest/environment-variables HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 221
Host: localhost:8080

{
  "_type" : "environment_variable",
  "name" : "create_ev_browser",
  "input_type" : "DROPDOWN_LIST",
  "options" : [ {
    "label" : "Chrome",
    "position" : 0
  }, {
    "label" : "Opera",
    "position" : 1
  } ]
}

Request fields

Path Type Description

_type

String

the type of the entity

input_type

String

the type of the environment variable: DROPDOWN_LIST, PLAIN_TEXT, INTERPRETED_TEXT

name

String

the name of the environment variable

options

Array

an array of environment variable options (for DROPDOWN_LIST)

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 353

{
  "_type" : "environment-variable",
  "id" : 4,
  "name" : "create_ev_browser",
  "options" : [ {
    "label" : "Chrome",
    "position" : 0
  }, {
    "label" : "Opera",
    "position" : 1
  } ],
  "input_type" : "DROPDOWN_LIST",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/environment-variables/4"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

id of the entity

input_type

String

the type of the environment variable: DROPDOWN_LIST, PLAIN_TEXT, INTERPRETED_TEXT

name

String

the name of the environment variable

options

Array

the array of environment variable options (for DROPDOWN_LIST)

_links

Object

related links

Relation Description

self

link to this environment-variable

delete Delete environment variable

A DELETE to /environment-variables/{ids} deletes the environment variable(s) with the given id(s).

HTTP request

DELETE /api/rest/latest/environment-variables/2,3 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/environment-variables/{ids}
Parameter Description

ids

a list id of the environment-variables to delete

HTTP response

HTTP/1.1 204 No Content

patch Modify environment variable name

A PATCH to /environment-variables/{id} modifies the name of the environment variable with the given id.

HTTP request

PATCH /api/rest/latest/environment-variables/5 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 32
Host: localhost:8080

{
  "name" : "updated_browser"
}

Path parameters

Table 1. /api/rest/latest/environment-variables/{id}
Parameter Description

id

the id of the environment variable

Request fields

Path Type Description

name

String

the updated name of the environment variable

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 303

{
  "_type" : "environment-variable",
  "id" : 5,
  "name" : "updated_browser",
  "options" : [ {
    "label" : "Firefox",
    "position" : 0
  } ],
  "input_type" : "DROPDOWN_LIST",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/environment-variables/5"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

id of the entity

input_type

String

the type of the environment variable: DROPDOWN_LIST, PLAIN_TEXT, INTERPRETED_TEXT

name

String

the name of the environment variable

options

Array

an array of environment variable options

_links

Object

related links

Relation Description

self

link to this environment-variables

post Create environment variable option

A POST to /environment-variables/{id}/options adds option to the environment variable with the given id .

HTTP request

POST /api/rest/latest/environment-variables/7/options HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 23
Host: localhost:8080

{
  "label" : "Opera"
}

Path parameters

Table 1. /api/rest/latest/environment-variables/{id}/options
Parameter Description

id

the id of the environment-variable

Request fields

Path Type Description

label

String

the label of the environment variable option

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 393

{
  "_type" : "environment-variable",
  "id" : 7,
  "name" : "browser",
  "options" : [ {
    "label" : "Chrome",
    "position" : 1
  }, {
    "label" : "Safari",
    "position" : 2
  }, {
    "label" : "Opera",
    "position" : 3
  } ],
  "input_type" : "DROPDOWN_LIST",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/environment-variables/7"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the environment variable

input_type

String

the input type of the environment variable

name

String

the name of the environment variable

options

Array

the environment variable’s options

_links

Object

related links

Relation Description

self

link to this environment variable

patch Modify environment variable option

A PATCH to /environment-variables/{id}/options/{optionLabel} modifies the option with given original label.

HTTP request

PATCH /api/rest/latest/environment-variables/6/options/Firefox HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 44
Host: localhost:8080

{
  "label" : "Safari",
  "position" : "0"
}

Path parameters

Table 1. /api/rest/latest/environment-variables/{id}/options/{optionLabel}
Parameter Description

id

the id of the environment variable to update

optionLabel

the label of the environment variable option to update

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 296

{
  "_type" : "environment-variable",
  "id" : 6,
  "name" : "evBrowser",
  "options" : [ {
    "label" : "Safari",
    "position" : 0
  } ],
  "input_type" : "DROPDOWN_LIST",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/environment-variables/6"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

id of the entity

input_type

String

the type of the environment variable: DROPDOWN_LIST, PLAIN_TEXT, INTERPRETED_TEXT

name

String

the name of the environment variable

options

Array

an array of environment variable options

_links

Object

related links

options[].label

String

the name of the option

options[].position

Number

the position of the option in the dropdown list of the environment variable

Relation Description

self

link to this environment variable

HTTP request

DELETE /api/rest/latest/environment-variables/2,3 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/environment-variables/{ids}
Parameter Description

ids

a list id of the environment-variables to delete

HTTP response

HTTP/1.1 204 No Content

delete Delete environment variable option

A DELETE to /environment-variables/{id}/options/{optionsLabel} deletes the environment variable option(s) with the given id and the given options label.

HTTP request

DELETE /api/rest/latest/environment-variables/2/options/opt2 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Path parameters

Table 1. /api/rest/latest/environment-variables/{id}/options/{optionsLabel}
Parameter Description

id

id of the entity

optionsLabel

a list of the environment variable options to delete

HTTP response

HTTP/1.1 204 No Content