Namespaces API

The /namespaces API endpoint

/namespaces (GET)

The /namespaces API endpoint provides HTTP GET access to namespace data.

EXAMPLE

The following example demonstrates a request to the /namespaces API, resulting in a JSON Array containing namespace definitions.

curl -s http://127.0.0.1:8080/api/core/v2/namespaces -H "Authorization: Bearer TOKEN"
[
  {
    "name": "default"
  },
  {
    "name": "development"
  }
]

API Specification

/namespaces (GET)
description Returns the list of namespaces.
example url http://hostname:8080/api/core/v2/namespaces
response type Array
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)
output
[
  {
    "name": "default"
  },
  {
    "name": "development"
  }
]

/namespaces (POST)

/namespaces (POST)
description Create a Sensu namespace.
example URL http://hostname:8080/api/core/v2/namespaces/default/namespaces
payload
{
  "name": "development"
}
response codes
  • Success: 200 (OK)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

The /namespaces/:namespace API endpoint

/namespaces/:namespace (PUT)

API Specification

/namespaces/:namespace (PUT)
description Create or update a Sensu namespace.
example URL http://hostname:8080/api/core/v2/namespaces/default/namespaces/development
payload
{
  "name": "development"
}
response codes
  • Success: 201 (Created)
  • Malformed: 400 (Bad Request)
  • Error: 500 (Internal Server Error)

/namespaces/:namespace (DELETE)

API Specification

/namespaces/:namespace (DELETE)
description Removes a namespace from Sensu given the namespace name.
example url http://hostname:8080/api/core/v2/namespaces/default/namespaces/development
response codes
  • Success: 202 (Accepted)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)