Environment Variable

Environment Variable is a combination of key and value pairs. It is uniquely identified by it id and a user can access only his Environment Variables. This resource can be used for defining dynamic Tasks whose command field can be redefined by specific values inside Environment Variable.

Scheme:

{
  "id": "UUID",
  "key": "String",
  "value": "String"
}

Example:

{
  "id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
  "key": "machine_states_endpoint",
  "value": "https://mstate.hid.facts4.work/api/machines"
}

GET methods

GET /api/v1/environment_variables

Returns all environment variables with their relative information if at least one resource exists, otherwise returns an empty collection. Request can contain a page parameter that returns a specific page, additionally total number of pages, next page, previous page and other information are described in the response header.

Example request:

GET /api/v1/environment_variables HTTP/1.1
Host: https://scheduler.hid.facts4.work

Example response:

HTTP/1.1 200 OK
Content-type: application/json

[
  {
    "id": "986c6f2e-7c49-4c0b-9bb3-9566ea3e9b02",
    "key": "machine_states_endpoint",
    "value": "https://mstate.hid.facts4.work/api/machines"
  },
  {
    "id": "0fc6d020-7f96-4424-9005-9e691d9c90e5",
    "key": "primary_machine_id",
    "value": "87f45184-c780-11e6-9d9d-cec0c932ce01"
  }
]
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Array of Objects:
 
  • id (string) – id of the environment variable
  • key (string) – key field
  • value (string) – value field
Status Codes:
GET /api/v1/environment_variable/:id

Returns a specific environment variable with :id and the rest of its parameters if it exists, otherwise returns 404 error.

Example request:

GET /api/v1/environment_variable/ae54af76-964f-4ed8-8700-793b2ed5c20b HTTP/1.1
Host: https://scheduler.hid.facts4.work

Example response:

HTTP/1.1 200 OK
Content-type: application/json

{
    "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
    "key": "defsol_server",
    "value": "https://defsol.hid.facts4.work"
}
Parameters:
  • id (string) – environment variable’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Object:
 
  • id (string) – id of the environment variable
  • key (string) – key of environment variable
  • value (string) – value of environment variable
Status Codes:

POST methods

POST /api/v1/environment_variables

Adds a new environment variable with its key and value. id is generated server-side. Returns the new resource or error message.

Note: Do not execute twice the same POST request for it will create two resources with the same information.

Example request:

POST /api/v1/environment_variables HTTP/1.1
Host: https://scheduler.hid.facts4.work
Content-Type: application/json

{
  "key": "defsol_server",
  "value": "https://defsol.hid.facts4.work"
}

Example response:

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

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "key": "defsol_server",
  "value": "https://defsol.hid.facts4.work"
}
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • key (string) – environment variable’s key
  • value (string) – environment variable’s value
Response JSON Object:
 
  • id (string) – id of the environment variable
  • key (string) – key of environment variable
  • value (string) – value of environment variable
Status Codes:

PUT methods

PUT /api/v1/environment_variables/:id

Updates an existing environment variables with new information. Returns the new resource or error message.

Note: All parameters must be defined with the PUT request, ie. PUT request replaces the existing resource with the modified one if it exists, or creates a new one.

Example request:

PUT /api/v1/environment_variables/ae54af76-964f-4ed8-8700-793b2ed5c20b HTTP/1.1
Host: https://scheduler.hid.facts4.work
Content-Type: application/json

{
  "key": "defsol_server",
  "value": "https://defsol.new.endpoint",
}

Example response:

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

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "key": "defsol_server",
  "value": "https://defsol.new.endpoint"
}
Parameters:
  • id (string) – environment variable’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • key (string) – environment variable’s key
  • value (string) – environment variable’s value
Response JSON Object:
 
  • id (string) – id of the environment variable
  • key (string) – key of environment variable
  • value (string) – value of environment variable
Status Codes:

DELETE methods

DELETE /api/v1/environment_variables/:id

Delete an existing environment variable, responds with the confirmation or error. Can only delete one resource at a time, to remove a collection of machines call the DELETE method for each element.

Example request:

DELETE /api/v1/environment_variables/ae54af76-964f-4ed8-8700-793b2ed5c20b HTTP/1.1
Host: https://scheduler.hid.facts4.work

Example response:

HTTP/1.1 200 OK
Parameters:
  • id (string) – environment variable’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Status Codes: