Event

Part of the API reference collection

This page is part of the Crunchy Bridge API reference, and primarily meant to act as an exhaustive guide for technical integrations which are already in progress. To understand the basics of using the API, see API concepts and getting started.

The Event API resource

An event represents an operation that occurred in the system. It contains a kind like cluster.created, a primary object associated with the event, and may also be associated with a cluster or team.

Content type: application/json

Name Nullable Type Description
id string in EID format

The primary ID of the event. IDs for events are generated in ascending order.

actor_email string

The email of the actor who initiated the event, if there was one.

actor_id string in EID format

The ID of the actor who initiated the event, if there was one. Actor IDs are always the identifier of an account.

actor_ip string

The IP from which the actor initiated the event, if there was an actor.

cluster_id string in EID format

The ID of the cluster associated with the event, if there was one.

created_at string of date/time formatted as RFC 3339

The time when the event occurred.

data object

Data captured at the time of the event. When an event is captured for another API resource, that API resource is rendered and stored in the data field. Note that no API compatibility is guaranteed on this previously rendered version and it’s therefore possible to have events whose data objects aren’t fully compliant with the current version of of that API resource.

description string

A human-readable description of the event. Note that this format is not guaranteed to be stable (it may change), so don’t compare against it programmatically. Use other fields instead.

kind string

The event’s kind. Looks something like cluster.created. Kinds are mostly common of the form *.created, *.updated, or *.destroyed, but other types of operations are possible depending on the action. For example, role.password_revealed is generated when the password for a Postgres role is requested.

object_id string in EID format

The ID of the primary object associated with the event. For example, for a cluster.created, this will be the cluster’s ID.

object_kind enum string

The kind of the primary object associated with the event. For example, for a cluster.created this will be cluster.

Enum access_token, account, api_key, changelog, cluster, credit, customer, discount, event, firewall_rule, invoice, logger, marketplace_resource, network, notification, organization, plan, postgres_version, provider, region, role, session, subscription, team, team_member, tempkey, or ticket.

previous_­properties object

Contains the previous values of properties that may have changed during the operation which produced this event, taken by comparing a new API resource to how it rendered before the change. Usually only present on *.updated events.

request_id string in UUID format

The ID of the request that instigated the action which caused this event to be captured, if there was one.

team_id string in EID format

The team associated with the event, if there was one. For example, for a cluster.created event, this would be the ID of team which owns the cluster.

Example

{
    "actor_email": null,
    "actor_id": "qvcw4hylovgyzbwzp53bmmlhga",
    "actor_ip": "73.70.33.3",
    "cluster_id": "rvf73a77ozfsvcttryebfrnlem",
    "created_at": "2021-07-11T01:02:03Z",
    "data": {
        "cidr4": "1.2.3.4/24",
        "id": "p56biajnfvgjhftvqs7lqymspe",
        "name": "crunchy-production-network",
        "provider_id": "aws",
        "region_id": "us-west-2",
        "team_id": "eaevtjiudzeq7bsqbbpiscund4"
    },
    "description": "[email protected] updated network `p56biajnfvgjhftvqs7lqymspe`.",
    "id": "klkvpx5enfdilaehwhvnmcfoiy",
    "kind": "network.created",
    "object_id": "p56biajnfvgjhftvqs7lqymspe",
    "object_kind": "network",
    "previous_properties": null,
    "request_id": "27a532f4-5bc8-4810-b602-88475a93167c",
    "team_id": "eaevtjiudzeq7bsqbbpiscund4"
}

List events

List events for an account, cluster, or team.

With no query parameters, events for which the authenticated account is the “actor” are returned, meaning events which were captured due to actions taken by the account. When cluster_id is specified, events pertaining to any actions that occurred on that cluster are returned instead. When team_id is specified, events taken by any member of that team are returned instead. Only one of these filters can be specified.

This endpoint’s pagination may be ordered through the order_field parameter by id only.

GET /events

Request

Query parameters

Name Required Type Description
cluster_id string

The cluster ID for which to retrieve events.

cursor string

Return only items starting after this cursor ID. When paginating, pass the value of next_cursor from the last page into this field to get the next one.

limit integer

The maximum number of items to return on the page. Defaults to 100 with a minimum of 1 and a maximum of 100.

order enum string

The order of pagination. asc for ascending or desc for descending. Defaults to asc.

Enum asc, or desc.

order_field string

The name of the field on which to paginate like id or name. Supported fields are specific to each endpoint, and it’s not possible to specify any arbitrary name. See the documentation for each specific list endpoint to see which fields it supports. Defaults to id for most resources.

team_id string

The team ID for which to retrieve events.

cURL example

curl -X GET https://api.crunchybridge.com/events
    -H "Authorization: Bearer $CRUNCHY_ACCESS_TOKEN"

Response

Status: 200

Response for listing events.

Content type: application/json

Name Nullable Type Description
events array of object of type Event

List of events for this page.

has_more boolean

Indicates whether or not there are more resources to page through in the collection.

next_cursor string in EID format

A cursor value to pass to the endpoint to get the next page.

Example

{
    "events": [
        {
            "actor_email": null,
            "actor_id": "qvcw4hylovgyzbwzp53bmmlhga",
            "actor_ip": "73.70.33.3",
            "cluster_id": "rvf73a77ozfsvcttryebfrnlem",
            "created_at": "2021-07-11T01:02:03Z",
            "data": {
                "cidr4": "1.2.3.4/24",
                "id": "p56biajnfvgjhftvqs7lqymspe",
                "name": "crunchy-production-network",
                "provider_id": "aws",
                "region_id": "us-west-2",
                "team_id": "eaevtjiudzeq7bsqbbpiscund4"
            },
            "description": "[email protected] updated network `p56biajnfvgjhftvqs7lqymspe`.",
            "id": "klkvpx5enfdilaehwhvnmcfoiy",
            "kind": "network.created",
            "object_id": "p56biajnfvgjhftvqs7lqymspe",
            "object_kind": "network",
            "previous_properties": null,
            "request_id": "27a532f4-5bc8-4810-b602-88475a93167c",
            "team_id": "eaevtjiudzeq7bsqbbpiscund4"
        }
    ],
    "has_more": false,
    "next_cursor": null
}

Get event

Get a specific event.

GET /events/{event_id}

Request

Path parameters

  • event_id: The ID of the event to be retrieved.

cURL example

curl -X GET https://api.crunchybridge.com/events/{event_id}
    -H "Authorization: Bearer $CRUNCHY_ACCESS_TOKEN"

Response

Status: 200

Responds with the standard Event API resource.