Event API
The Event API allows you to track stateful occurrences over time. Unlike a simple Message, an Event has a lifecycle (Start -> Updates -> Close).
Endpoints
Section titled “Endpoints”| Action | Method | Path |
|---|---|---|
| Create | POST | /v1/channel/{channel_id}/event/create |
| Update | POST | /v1/channel/{channel_id}/event/update |
| Close | POST | /v1/channel/{channel_id}/event/close |
Headers
Section titled “Headers”| Header | Value | Description |
|---|---|---|
Content-Type | application/json | Always required. |
Authorization | Bearer <token> | Your secret gateway token. |
Common Fields
Section titled “Common Fields”| Field | Type | Required | Description |
|---|---|---|---|
password | string | Yes | Channel password (8-128 chars). |
event_id | string | No* | Unique ID for the event. Required for Update and Close. If omitted in Create, a random ID is returned. |
event_type | string | Yes | A category for the event (e.g., motion_detected, system_backup). |
severity | enum | No | critical, high, normal, low. |
attrs | object | No | A JSON object containing event-specific data (e.g., { "battery": 80 }). |
Endpoint Details
Section titled “Endpoint Details”1. Create Event
Section titled “1. Create Event”Initialize a new event.
curl -X POST https://api.pushgo.io/v1/channel/ABC123XYZ/event/create \ -H "Content-Type: application/json" \ -d '{ "password": "your_password", "event_type": "door_open", "severity": "high", "started_at": 1672531200 }'2. Update Event
Section titled “2. Update Event”Add new information to an ongoing event. The new attrs will be merged with the existing ones.
curl -X POST https://api.pushgo.io/v1/channel/ABC123XYZ/event/update \ -H "Content-Type: application/json" \ -d '{ "password": "your_password", "event_id": "PREVIOUSLY_CREATED_ID", "attrs": { "still_open": true } }'3. Close Event
Section titled “3. Close Event”Mark the event as finished.
curl -X POST https://api.pushgo.io/v1/channel/ABC123XYZ/event/close \ -H "Content-Type: application/json" \ -d '{ "password": "your_password", "event_id": "PREVIOUSLY_CREATED_ID", "ended_at": 1672534800 }'Response
Section titled “Response”Successful requests return the event_id:
{ "event_id": "550e8400-e29b-41d4-a716-446655440000"}