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.
NOTE: Requests to the web UI configuration API require you to authenticate with a Sensu access token or API key.
The code examples in this document use the environment variable $SENSU_API_KEY
to represent a valid API key in API requests.
Get the web UI configuration
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: Key $SENSU_API_KEY" \
-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",
"https://grafana-host/render/metrics?width=500&height=250#sensu.io.graphic"
]
}
}
}
]
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 |
|
output |
|
Get a specific web UI configuration
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: Key $SENSU_API_KEY"
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",
"https://grafana-host/render/metrics?width=500&height=250#sensu.io.graphic"
]
}
}
}
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 |
|
output |
|
Create and update a web UI configuration
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: Key $SENSU_API_KEY" \
-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",
"https://grafana-host/render/metrics?width=500&height=250#sensu.io.graphic"
]
}
}
}' \
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 |
|
response codes |
|
Delete a web UI configuration
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: Key $SENSU_API_KEY" \
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 |
|