Datastore API

The /provider API endpoint

/provider (GET)

The /provider API endpoint provides HTTP GET access to Sensu datastore data.

EXAMPLE

The following example demonstrates a request to the /provider API, resulting in a JSON map that contains a list of Sensu datastore providers.

curl -H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/enterprise/store/v1/provider

HTTP/1.1 200 OK
[
    {
        "type": "PostgresConfig",
        "api_version": "store/v1",
        "metadata": {},
        "spec": {
            "dsn": "postgresql://user:secret@host:port/otherdbname",
            "pool_size": 20,
            "metadata": {
                "name": "my-other-postgres"
            }
        }
    },
    {
        "type": "PostgresConfig",
        "api_version": "store/v1",
        "metadata": {},
        "spec": {
            "dsn": "postgresql://user:secret@host:port/dbname",
            "pool_size": 20,
            "metadata": {
                "name": "my-postgres"
            }
        }
    }
]

API Specification

/provider (GET)
description Retrieves the list of datastore providers.
example url http://hostname:8080/api/enterprise/store/v1/provider
response type Map
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)

The /provider/:provider API endpoint

/provider/:provider (GET)

EXAMPLE

curl -X GET \
-H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/enterprise/store/v1/provider/my-postgres

HTTP/1.1 200 OK
{
    "type": "PostgresConfig",
    "api_version": "store/v1",
    "metadata": {},
    "spec": {
        "dsn": "postgresql://user:secret@host:port/dbname",
        "pool_size": 20,
        "metadata": {
            "name": "my-postgres"
        }
    }
}

API Specification

/provider/:provider (GET)
description Retrieves the specified datastore provider.
example url http://hostname:8080/api/enterprise/store/v1/provider/my-postgres
url parameters Required: my-postgres (name of provider to retrieve).
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)

/provider/:provider (PUT)

EXAMPLE

curl -X PUT \
-H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/enterprise/store/v1/provider/my-postgres

{
  "type": "PostgresConfig",
  "api_version": "store/v1",
  "metadata": {
    "name": "my-postgres"
  },
  "spec": {
    "dsn": "postgresql://user:secret@host:port/dbname",
    "pool_size": 20
  }
}

HTTP/1.1 200 OK

API Specification

/provider/:provider (PUT)
description Creates a datastore provider.
example url http://hostname:8080/api/enterprise/store/v1/provider/my-postgres
url parameters Required: my-postgres (name to use for provider).
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)

/provider/:provider (DELETE)

The /provider/:provider API endpoint provides HTTP DELETE access to remove a Sensu datastore provider.

EXAMPLE

The following example shows a request to remove the Sensu datastore provider with the ID 9927110dc66458af, resulting in a successful HTTP 204 No Content response.

curl -X DELETE \
-H "Authorization: Bearer $SENSU_TOKEN" \
http://127.0.0.1:8080/api/enterprise/store/v1/provider/my-postgres

HTTP/1.1 204 No Content

API Specification

/provider/:provider (DELETE)
description Removes the specified datastore provider.
example url http://hostname:8080/api/enterprise/store/v1/provider/my-postgres
url parameters Required: my-postgres (name of provider to delete).
response codes
  • Success: 204 (No Content)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)