Web UI configuration API

COMMERCIAL FEATURE: Access web UI configuration in the packaged Sensu Go distribution. For more information, see Get started with commercial features.

The /config API endpoint

/config (GET)

The /config API endpoint provides HTTP GET access to the global web UI configuration.

EXAMPLE

The following example demonstrates a request to the /config API endpoint, resulting in a JSON array that contains the global web UI configuration.

curl -X GET \
http://127.0.0.1:8080/api/enterprise/web/v1/config \
-H "Authorization: Bearer $SENSU_ACCESS_TOKEN" \
-H 'Content-Type: application/json'

HTTP/1.1 200 OK
[
  {
    "type": "GlobalConfig",
    "api_version": "web/v1",
    "metadata": {
      "name": "custom-web-ui",
      "created_by": "admin"
    },
    "spec": {
      "always_show_local_cluster": false,
      "default_preferences": {
        "page_size": 50,
        "theme": "sensu"
      },
      "link_policy": {
        "allow_list": true,
        "urls": [
          "https://example.com",
          "steamapp://34234234",
          "//google.com",
          "//*.google.com",
          "//bob.local"
        ]
      }
    }
  }
]

API Specification

/web (GET)
description Returns the list of global web UI configurations.
example url http://hostname:8080/api/enterprise/web/v1/config
response type Map
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)
output
[
  {
    "type": "GlobalConfig",
    "api_version": "web/v1",
    "metadata": {
      "name": "custom-web-ui",
      "created_by": "admin"
    },
    "spec": {
      "always_show_local_cluster": false,
      "default_preferences": {
        "page_size": 50,
        "theme": "sensu"
      },
      "link_policy": {
        "allow_list": true,
        "urls": [
          "https://example.com",
          "steamapp://34234234",
          "//google.com",
          "//*.google.com",
          "//bob.local"
        ]
      }
    }
  }
]

The /config/:globalconfig API endpoint

/config/:globalconfig (GET)

The /config/:globalconfig API endpoint provides HTTP GET access to global web UI configuration data, specified by configuration name.

EXAMPLE

In the following example, querying the /config/:globalconfig API endpoint returns a JSON map that contains the requested :globalconfig definition (in this example, for the :globalconfig named custom-web-ui).

curl -X GET \
http://127.0.0.1:8080/api/enterprise/web/v1/config/custom-web-ui \
-H "Authorization: Bearer $SENSU_ACCESS_TOKEN"

HTTP/1.1 200 OK
{
  "type": "GlobalConfig",
  "api_version": "web/v1",
  "metadata": {
    "name": "custom-web-ui",
    "created_by": "admin"
  },
  "spec": {
    "always_show_local_cluster": false,
    "default_preferences": {
      "page_size": 50,
      "theme": "sensu"
    },
    "link_policy": {
      "allow_list": true,
      "urls": [
        "https://example.com",
        "steamapp://34234234",
        "//google.com",
        "//*.google.com",
        "//bob.local"
      ]
    }
  }
}

API Specification

/config/:globalconfig (GET)
description Returns the specified global web UI configuration.
example url http://hostname:8080/api/enterprise/web/v1/config/custom-web-ui
response type Map
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)
output
{
  "type": "GlobalConfig",
  "api_version": "web/v1",
  "metadata": {
    "name": "custom-web-ui",
    "created_by": "admin"
  },
  "spec": {
    "always_show_local_cluster": false,
    "default_preferences": {
      "page_size": 50,
      "theme": "sensu"
    },
    "link_policy": {
      "allow_list": true,
      "urls": [
        "https://example.com",
        "steamapp://34234234",
        "//google.com",
        "//*.google.com",
        "//bob.local"
      ]
    }
  }
}

/config/:globalconfig (PUT)

The /config/:globalconfig API endpoint provides HTTP PUT access to create and update global web UI configurations, specified by configuration name.

EXAMPLE

In the following example, an HTTP PUT request is submitted to the /config/:globalconfig API endpoint to update the custom-web-ui configuration, resulting in an HTTP 200 OK response and the updated configuration definition.

curl -X PUT \
-H "Authorization: Bearer $SENSU_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
  "type": "GlobalConfig",
  "api_version": "web/v1",
  "metadata": {
    "name": "custom-web-ui",
    "created_by": "admin"
  },
  "spec": {
    "always_show_local_cluster": false,
    "default_preferences": {
      "page_size": 50,
      "theme": "sensu"
    },
    "link_policy": {
      "allow_list": true,
      "urls": [
        "https://example.com",
        "steamapp://34234234",
        "//google.com",
        "//*.google.com",
        "//bob.local"
      ]
    }
  }
}' \
http://127.0.0.1:8080/api/enterprise/web/v1/config/custom-web-ui

HTTP/1.1 201 Created

API Specification

/config/:globalconfig (PUT)
description Creates or updates the specified global web UI configuration.
example URL http://hostname:8080/api/enterprise/web/v1/config/custom-web-ui
payload
{
  "type": "GlobalConfig",
  "api_version": "web/v1",
  "metadata": {
    "name": "custom-web-ui",
    "created_by": "admin"
  },
  "spec": {
    "always_show_local_cluster": false,
    "default_preferences": {
      "page_size": 50,
      "theme": "sensu"
    },
    "link_policy": {
      "allow_list": true,
      "urls": [
        "https://example.com",
        "steamapp://34234234",
        "//google.com",
        "//*.google.com",
        "//bob.local"
      ]
    }
  }
}
response codes
  • Success: 201 (Created)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

/config/:globalconfig (DELETE)

The /config/:globalconfig API endpoint provides HTTP DELETE access to delete a global web UI configuration from Sensu, specified by the configuration name.

EXAMPLE

The following example shows a request to the /config/:globalconfig API endpoint to delete the global web UI configuration named custom-web-ui, resulting in a successful HTTP 204 No Content response.

curl -X DELETE \
-H "Authorization: Bearer $SENSU_ACCESS_TOKEN" \
http://127.0.0.1:8080/api/enterprise/web/v1/config/custom-web-ui

HTTP/1.1 204 No Content

API Specification

/config/:globalconfig (DELETE)
description Removes the specified global web UI configuration from Sensu.
example url http://hostname:8080/api/enterprise/web/v1/config/custom-web-ui
response codes
  • Success: 204 (No Content)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)