1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/website/docs/reference/api/legacy/unleash/admin/events.md

137 lines
3.6 KiB
Markdown
Raw Normal View History

---
title: /api/admin/events
---
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
import ApiRequest from '@site/src/components/ApiRequest'
:::note
refactor: move docs into new structure / fix links for SEO (#2416) ## What This (admittedly massive) PR updates the "physical" documentation structure and fixes url inconsistencies and SEO problems reported by marketing. The main points are: - remove or move directories : advanced, user_guide, deploy, api - move the files contained within to the appropriate one of topics, how-to, tutorials, or reference - update internal doc links and product links to the content - create client-side redirects for all the urls that have changed. A number of the files have been renamed in small ways to better match their url and to make them easier to find. Additionally, the top-level api directory has been moved to /reference/api/legacy/unleash (see the discussion points section for more on this). ## Why When moving our doc structure to diataxis a while back, we left the "physical' files lying where they were, because it didn't matter much to the new structure. However, that did introduce some inconsistencies with where you place docs and how we organize them. There's also the discrepancies in whether urls us underscores or hyphens (which isn't necessarily the same as their file name), which has been annoying me for a while, but now has also been raised by marketing as an issue in terms of SEO. ## Discussion points The old, hand-written API docs have been moved from /api to /reference/api/legacy/unleash. There _is_ a /reference/api/unleash directory, but this is being populated by the OpenAPI plugin, and mixing those could only cause trouble. However, I'm unsure about putting /legacy/ in the title, because the API isn't legacy, the docs are. Maybe we could use another path? Like /old-docs/ or something? I'd appreciate some input on this.
2022-11-22 10:05:30 +01:00
In order to access the admin API endpoints you need to identify yourself. Unless you're using the `none` authentication method, you'll need to [create an ADMIN token](/how-to/how-to-create-api-tokens) and add an Authorization header using the token.
:::
The Events API lets you retrieve [events](/reference/event-types.mdx) from your Unleash instance.
2016-11-30 21:17:39 +01:00
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
## Event endpoints
2016-11-30 21:17:39 +01:00
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
### Get all events
2016-11-30 21:17:39 +01:00
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
<ApiRequest verb="get" url="api/admin/events" title="Retrieve all events from the Unleash instance."/>
2016-11-30 21:17:39 +01:00
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
#### Query parameters
| Query parameter | Description | Required |
| --- | --- | --- |
| `project` | When applied, the endpoint will only return events from the given project. | No |
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
When called without any query parameters, the endpoint will return the **last 100 events** from the Unleash instance. When called with a `project` query parameter, it will return only events related to that project, but it will return **all the events**, and not just the last 100.
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
#### Get events by project
<ApiRequest verb="get" url="api/admin/events?project=<project-name>" title="Retrieve all events belonging to the given project."/>
Use the `project` query parameter to make the API return _all_ events pertaining to the given project.
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
#### Responses
<details>
<summary>Responses</summary>
##### 200 OK
The last 100 events from the Unleash server when called without a `project` query parameter.
When called with a `project` query parameter: all events related to that project.
```json title="Successful response; a list of events"
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
{
"version": 1,
"events": [
{
"id": 842,
"type": "feature-environment-enabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:49.521Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
},
{
"id": 841,
"type": "feature-environment-disabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:45.986Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
}
]
}
```
</details>
### Get events for a specific toggle
<ApiRequest verb="get" url="api/admin/events/<toggle-name>" title="Retrieve all events related to the given toggle."/>
Fetch all events related to a specified toggle.
#### Responses
<details>
<summary>Responses</summary>
###### 200 OK
The list of events related to the given toggle.
```json title="Successful response; all events relating to the specified toggle"
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
{
"toggleName": "my-constrained-toggle",
"events": [
{
"id": 842,
"type": "feature-environment-enabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:49.521Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
},
{
"id": 841,
"type": "feature-environment-disabled",
"createdBy": "user@company.com",
"createdAt": "2022-05-12T08:49:45.986Z",
"data": null,
"preData": null,
"tags": [],
"featureName": "my-constrained-toggle",
"project": "my-project",
"environment": "development"
}
]
}
```
</details>
## Event type description
:::note Content moved
fix: env drop event data.name + /api/admin/events docs (#1662) * docs: add all /events endpoints and query params * docs: events page skeleton structure * docs: correct description of event payloads * docs: add table with event properties. * docs: remove duplicate table. * docs: sort property table * docs: more work on adding events: feature events * docs: add examples for most feature events Still missing are: events that require imports, and feature-project-change * docs: scaffold out all events descriptions * docs: normalize casing * docs: add brief descriptions to strategy and context events * docs: Add remaining non-import event descriptions and examples * docs: add code sample annotations for all example events. * docs: remove all references to myself * docs: change "toggle" -> "feature", adjust headings The headings aren't semantic for this doc yet. We'll need to create a new document for this. * docs: update event type description table * docs: change header level of event type section * docs: add details around feature-project-change event * docs: add import type events * docs: use a better `createdBy` name * docs: "sort" events so that they're in a consistent order. * docs: remove reference to ID in addon-config-created event * fix: drop-environments data.name all-projects -> all-environments This is probably a bug. Should be double checked. * docs: clarify that `data.name` is always `all-x` on drop events * Apply suggestions from code review Co-authored-by: sighphyre <liquidwicked64@gmail.com> Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-06-07 12:33:30 +02:00
This section has been moved to a dedicated [event type reference document](/reference/event-types.mdx).
:::