Assets API
The /assets
API endpoint
/assets
(GET)
The /assets
API endpoint provides HTTP GET access to asset data.
EXAMPLE
The following example demonstrates a request to the /assets
API, resulting in
a JSON Array containing asset definitions.
curl -s http://127.0.0.1:8080/api/core/v2/namespaces/default/assets -H "Authorization: Bearer TOKEN"
[
{
"url": "http://example.com/asset1.tar.gz",
"sha512": "4f926bf4328fbad2b9cac873d117f771914f4b837c9c85584c38ccf55a3ef3c2e8d154812246e5dda4a87450576b2c58ad9ab40c9e2edc31b288d066b195b21b",
"metadata": {
"name": "check_script1",
"namespace": "default",
"labels": null,
"annotations": null
}
}
]
API Specification
/assets (GET) | |
---|---|
description | Returns the list of assets. |
example url | http://hostname:8080/api/core/v2/namespaces/default/assets |
response type | Array |
response codes |
|
output |
|
/assets
(POST)
/assets (POST) | |
---|---|
description | Create a Sensu asset. |
example URL | http://hostname:8080/api/core/v2/namespaces/default/assets |
payload |
|
response codes |
|
The /assets/:asset
API endpoint
/assets/:asset
(GET)
The /assets/:asset
API endpoint provides HTTP GET access to asset data for specific :asset
definitions, by asset name
.
EXAMPLE
In the following example, querying the /assets/:asset
API returns a JSON Map
containing the requested :asset
definition (in this example: for the :asset
named
check_script
).
curl -s http://127.0.0.1:8080/api/core/v2/namespaces/default/assets/check_script -H "Authorization: Bearer TOKEN"
{
"url": "http://example.com/asset.tar.gz",
"sha512": "4f926bf4328fbad2b9cac873d117f771914f4b837c9c85584c38ccf55a3ef3c2e8d154812246e5dda4a87450576b2c58ad9ab40c9e2edc31b288d066b195b21b",
"filters": [
"system.os == 'linux'",
"system.arch == 'amd64'"
],
"metadata": {
"name": "check_script",
"namespace": "default",
"labels": null,
"annotations": null
}
}
API Specification
/assets/:asset (GET) | |
---|---|
description | Returns an asset. |
example url | http://hostname:8080/api/core/v2/namespaces/default/assets/check_script |
response type | Map |
response codes |
|
output |
|
/assets/:asset
(PUT)
API Specification
/assets/:asset (PUT) | |
---|---|
description | Create or update a Sensu asset. |
example URL | http://hostname:8080/api/core/v2/namespaces/default/assets/check_script |
payload |
|
response codes |
|