API Documentation - vasanthv/ahey GitHub Wiki
Authentication
To interact with the API and publish to a channel, you must log in and obtain an API key. The API key will be used for authentication in subsequent requests.
API Endpoints
/push/:channel
- Send a push notification to a channel
1. -
Method:
POST
-
Description: Sends a push notification to a specific channel.
-
Authentication: Requires an API key passed in the X-API-KEY header.
-
URL Format:
/push/:channel
where:channel
is the channel name. -
Body Example:
{ "body": "Your push content" }
-
Response Example:
{ "message": "Pushed successfully" }
curl -X POST "https://ahey.io/api/push/channel-name" \ -H "X-API-KEY: your-api-key" \ -H "Content-Type: application/json" \ -d '{"body": "Your push content"}'
/pull/:channel
- Retrieve the latest pushes from a channel
2. -
Method:
GET
-
Description: Retrieves the latest 50 messages from a specific channel.
-
Authentication: Requires an API key passed in the X-API-KEY header.
-
Query Parameter:
skip
(optional) - Skips the firstn
messages in the channel (useful for pagination).
-
URL Format:
/pull/:channel
where:channel
is the channel name. -
Response Example:
{ "pushes": [ { "from": { "username": "john" }, "body": "Hello, world!", "channel": "test-channel", "date": "2025-01-28T19:07:40.011Z" } ], "subscribers": 10 }
curl -X GET "https://ahey.io/api/pull/channel-name?skip=0" \ -H "X-API-KEY: your-api-key"
/me
- Get current user's details
3. -
Method:
GET
-
Description: Returns details of the currently authenticated user.
-
Authentication: Requires an API key passed in the X-API-KEY header.
-
Response Example:
{ "username": "john_doe", "email": "[email protected]", "joinedOn": "2025-01-01T12:00:00Z", "savedChannels": ["channel-1", "channel-2"] }
curl -X GET "https://ahey.io/api/me" \ -H "X-API-KEY: your-api-key"