Events
Read the project’s change feed in order from a cursor.
Paths are relative to https://api.agentpost.tools/v1/resources. Who may call explains each credential.
Read events
GET /events
Lists the project’s retained changes in order after a cursor and gives the next cursor. Send after=latest to start from now. A cursor behind the oldest change kept is refused with cursor_expired, whose details give the oldest and latest seq. Change feed retention explains which changes the feed keeps. For your server’s secret key: a credential confined to one holder, such as a user token, is refused.
- Who may call: Your server, with your project’s secret key.
- Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.events.read(query) - Pages:
limit, 1 to 500, default 100. A feed: every answer hasnext, to send asafter. Lists has the rule.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
after |
integer or string or string |
No | The seq to read after, or latest to start from now: no events, and next set to the newest seq. Start at 0, then pass each page’s next. Any integer or string, or "latest". |
limit |
integer |
No | The most events to answer with, from 1 to 500; 1–500; default 100. |
types |
string |
No | Full event types to keep, separated by commas. Without it, every type. |
Response
200 OK, with EventsPage.
Errors
invalid_request(400)cursor_expired(410)
Any operation can also answer with the codes Conventions lists.
The EventsPage object
One page of the feed. after=latest answers no events and the newest seq as next; a cursor behind the oldest event kept is cursor_expired.
| Name | Type | Present | Description |
|---|---|---|---|
events |
ChangeEvent array |
Always | |
next |
number |
Always | Pass as after to continue. Always present. A full page gives its last event’s seq. A shorter page has caught up, so it gives the newest seq read, past any events a types filter skipped. |
The ChangeEvent object
One change-feed record: CloudEvents 1.0, structured JSON. Written out in full, the kit’s ChangeEventBase with this service’s source, so the SDK’s generated types need nothing from the kit.
| Name | Type | Present | Description |
|---|---|---|---|
id |
string |
Always | A plain ULID, unique to the event. |
seq |
number |
Always | The event’s place in the project’s feed, from 1. Pass it as after to read the events after it. |
specversion |
"1.0" |
Always | |
type |
string |
Always | |
source |
"/resourceshark" |
Always | EVENT_SOURCE, written out so the SDK’s generated types need no value. |
subject |
string |
When set | The record the event is about. |
time |
string |
Always | An ISO 8601 date and time. |
datacontenttype |
"application/json" |
Always | |
data |
object |
Always | |
data. |
ActingContext |
Always | Who made the change, and for whom. |
The ActingContext object
Who made a change and for whom, as a change-feed event carries it: the actor, and the delegator when the actor acted under a delegation. ResourceShark’s own changes, such as a sweep’s, name the service principal resourceshark.
| Name | Type | Present | Description |
|---|---|---|---|
actor |
PrincipalRef |
Always | The principal that made the request with its own credential. Your project’s secret key is key: and the key’s name, with no kind. |
onBehalfOf |
PrincipalRef |
When set | The delegator, when the actor acted under a delegation. |