API Overview

The Bonsai Asset Index application includes an application programming interface (API) for retrieving information about assets.

Service Endpoint

All API endpoints are rooted at the URL https://bonsai.sensu.io/api/v1/. All requests to the host must use the secure HTTPS protocol.

Authorization

Currently, the Bonsai Asset Index application does not authenticate the caller making requests to the endpoints, and therefore does not authorize specific endpoints according to the caller’s permission level. In the future, this may change.

JSON Payloads

The responses returned by the API endpoints have JSON data payloads. The JSON format is custom to the Bonsai Asset Index application and does not follow any of the latest standards. Please see the documentation for each endpoint for a detailed example of the endpoint’s response payload.

HTTP Status Codes

Requests to the API endpoints may result in one of the following status codes:

  • 200 - Successful data retrieval
  • 404 - The requested item is not found

Resources

Assets

Resource Description
GET /api/v1/assets Retrieve data for all the assets in the Bonsai Asset Index. Results are paginated, with pagination controlled via the "start" and "items" params. If there are remaining pages to be retrieved, the payload will include a "next" URL.
GET /api/v1/assets/:username/:id Retrieve data for a single asset, identified by a username and repo ID.
PUT /api/v1/assets/recompile/:username/:id Recompile assets in the Bonsai Asset Index. This endpoint functions for authenticated users (via API auth), and authorized users (site owner, admin). Requires a header tag of X-Ops-Userid with the username of the authenticated user. Responds with either success or error.
PUT /api/v1/assets/:username/:id Update data for a single asset, identified by a username and repo ID. Currently limited to just updating tags. The authentication headers consists of the following params: 'X-Ops-Userid' => "username" where username is the owner of the asset or the site admin. This is required as authentication for each request. Authentication headers example: "X-Ops-Userid": "username",

Release_assets

Resource Description
GET /api/v1/assets/:username/:id/:version/release_asset_builds Retrieve an asset's multi-build details, suitable for consumption by the sensu tool.
GET /api/v1/assets/:username/:id/:version/:platform/:arch/release_asset Retrieve an asset's build-specific details, suitable for consumption by the sensu tool.