openapi: 3.0.3 info: contact: email: engineering@blues.io name: Blues Engineering url: https://dev.blues.io/support/ description: 'The OpenAPI definition for the Notehub.io API. ' title: Notehub alert monitor API version: 1.2.0 servers: - description: Production server url: https://api.notefile.net tags: - name: monitor paths: /v1/projects/{projectOrProductUID}/monitors: get: operationId: GetMonitors description: Get list of defined Monitors parameters: - $ref: '#/components/parameters/projectOrProductUIDParam' responses: '200': $ref: '#/components/responses/MonitorsResponse' default: $ref: '#/components/responses/ErrorResponse' security: - personalAccessToken: [] tags: - monitor x-custom-attributes: permission: read resource: blues:resources:app:APPSERIAL:devices post: operationId: CreateMonitor description: Create a new Monitor parameters: - $ref: '#/components/parameters/projectOrProductUIDParam' requestBody: description: Body or payload of monitor to be created required: true content: application/json: schema: $ref: '#/components/schemas/CreateMonitor' responses: '201': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Monitor' default: $ref: '#/components/responses/ErrorResponse' security: - personalAccessToken: [] tags: - monitor x-custom-attributes: permission: create resource: blues:resources:app:APPSERIAL:devices /v1/projects/{projectOrProductUID}/monitors/{monitorUID}: delete: operationId: DeleteMonitor description: Delete Monitor parameters: - $ref: '#/components/parameters/projectOrProductUIDParam' - $ref: '#/components/parameters/monitorUIDParam' responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Monitor' default: $ref: '#/components/responses/ErrorResponse' security: - personalAccessToken: [] tags: - monitor x-custom-attributes: permission: delete resource: blues:resources:app:APPSERIAL:devices get: operationId: GetMonitor description: Get Monitor parameters: - $ref: '#/components/parameters/projectOrProductUIDParam' - $ref: '#/components/parameters/monitorUIDParam' responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Monitor' default: $ref: '#/components/responses/ErrorResponse' security: - personalAccessToken: [] tags: - monitor x-custom-attributes: permission: read resource: blues:resources:app:APPSERIAL:devices put: operationId: UpdateMonitor description: Update Monitor parameters: - $ref: '#/components/parameters/projectOrProductUIDParam' - $ref: '#/components/parameters/monitorUIDParam' requestBody: description: Body or payload of monitor to be created required: true content: application/json: schema: $ref: '#/components/schemas/Monitor' responses: '200': description: Successful operation content: application/json: schema: $ref: '#/components/schemas/Monitor' default: $ref: '#/components/responses/ErrorResponse' security: - personalAccessToken: [] tags: - monitor x-custom-attributes: permission: update resource: blues:resources:app:APPSERIAL:devices components: responses: ErrorResponse: description: The response body in case of an API error. content: application/json: schema: type: '' properties: {} $ref: '#/components/schemas/Error' MonitorsResponse: description: The response body from GET /monitors content: application/json: schema: type: array items: $ref: '#/components/schemas/Monitor' properties: {} required: - monitors schemas: SlackWebHookNotification: type: object properties: message_type: description: text or blocks type: string enum: - text - blocks text: description: The text of the message, or the blocks definition type: string url: description: The URL of the Slack webhook. type: string SlackBearerNotification: type: object properties: channel: description: The channel to send the message to. type: string message_type: description: text or blocks type: string enum: - text - blocks text: description: The text of the message, or the blocks definition type: string token: description: The bearer token for the Slack app. type: string CreateMonitor: type: '' properties: {} allOf: - $ref: '#/components/schemas/Monitor' - required: - name - description - alert_routes - source_type - threshold Monitor: type: object properties: aggregate_function: description: Aggregate function to apply to the selected values before applying the condition. [none, sum, average, max, min] type: string enum: - none - sum - average - max - min aggregate_window: description: The time window to aggregate the selected values. It follows the format of a number followed by a time unit type: string example: 10m or 5h30m40s pattern: ^[0-9]+[smh]$ alert: description: If true, the monitor is in alert state. type: boolean alert_routes: type: array items: oneOf: - $ref: '#/components/schemas/SlackWebHookNotification' - $ref: '#/components/schemas/SlackBearerNotification' - $ref: '#/components/schemas/EmailNotification' condition_type: description: A comparison operation to apply to the value selected by the source_selector [greater_than, greater_than_or_equal_to, less_than, less_than_or_equal_to, equal_to, not_equal_to] type: string enum: - greater_than - greater_than_or_equal_to - less_than - less_than_or_equal_to - equal_to - not_equal_to - count description: type: string disabled: description: If true, the monitor will not be evaluated. type: boolean fleet_filter: type: array items: type: string last_routed_at: description: The last time the monitor was evaluated and routed. type: string name: type: string notefile_filter: type: array items: type: string per_device: description: Only relevant when using an aggregate_function. If true, the monitor will be evaluated per device, | rather than across the set of selected devices. If true then if a single device matches the specified criteria, | and alert will be created, otherwise the aggregate function will be applied across all devices. type: boolean routing_cooldown_period: description: The time period to wait before routing another event after the monitor | has been triggered. It follows the format of a number followed by a time unit. type: string example: 10m or 5h30m40s pattern: ^[0-9]+[smh]$ silenced: description: If true, alerts will be created, but no notifications will be sent. type: boolean source_selector: description: A valid JSONata expression that selects the value to monitor from the source. | It should return a single, numeric value. type: string example: body.temperature source_type: description: The type of source to monitor. Supported values are "event" and "heartbeat". type: string enum: - event - heartbeat threshold: description: The type of condition to apply to the value selected by the source_selector type: integer uid: type: string usage_scope: description: 'For usage monitors: the scope of aggregation. Supported values are "device" and "fleet".' type: string usage_type: description: 'For usage monitors: the type of data usage to monitor. Supported values are "cellular" and "satellite".' type: string usage_window: description: 'For usage monitors: the rolling time window in days to sum usage over (e.g. 30 for 30 days).' type: integer format: int32 Error: type: object properties: code: description: The HTTP error code associated with the error. type: integer maximum: 599 minimum: 300 debug: type: string details: type: object err: description: Human readable error message. type: string request: type: string status: description: Machine readable representation of the HTTP error code. type: string required: - err - code - status EmailNotification: type: object properties: email: description: Email Address type: string example: example@blues.com parameters: projectOrProductUIDParam: example: app:2606f411-dea6-44a0-9743-1130f57d77d8 in: path name: projectOrProductUID required: true schema: type: string monitorUIDParam: example: monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad in: path name: monitorUID required: true schema: type: string securitySchemes: personalAccessToken: description: 'Use a personal access token from notehub.io/api-access ' scheme: bearer type: http externalDocs: description: Find out more about Blues url: https://blues.io