SocketBee REST API Documentation
Overview
The SocketBee REST API allows developers to send events to specific channels within an application. This API is accessible over HTTPS and is authenticated using an app_id
, secret
, and key
.
Base URL
The base URL for the API requests is:
https://east-1.socket.socketbee.com:443
Endpoints
Send Event
URL: /send-event/{app_id}
Method: POST
Description: This endpoint allows you to send an event to a specified channel within the application.
Headers:
Content-Type
: Must beapplication/json
secret
: Your API secret key.key
: Your API key.
Path Parameters:
app_id
: The ID of your application.
Request Body:
The body of the request should be a JSON object with the following structure:
{
"channel": "channel_name",
"event": {
"event": "event_name",
"data": {
"key1": "value1",
"key2": "value2"
// additional data as needed
}
}
}
channel
(string): The name of the channel to which the event will be sent.event
(object): An object containing the event details.event
(string): The name of the event.data
(object): A JSON object containing the event data.
Example Request:
{
"channel": "user-updates",
"event": {
"event": "user-joined",
"data": {
"user_id": "12345",
"username": "john_doe"
}
}
}
Response:
- Success (HTTP Status 200):
status
(integer): The HTTP status code.body
(string): A success message or the response body.
{
"status": 200,
"body": "Event sent successfully."
}
- Error (HTTP Status 4xx/5xx):
status
(integer): The HTTP status code.errors
(string): An error message or the response body.
{
"status": 400,
"errors": "Invalid request parameters."
}
Error Handling
If the API request fails, the response will include an error message indicating the reason for the failure.
- Network Error:
status
(integer):0
error_message
(string): A description of the network error.
{
"status": 0,
"error_message": "Network connection error."
}
Authentication
The API uses headers for authentication. Ensure that you include the secret
and key
headers in every request.
Example Headers:
Content-Type: application/json
secret: your_api_secret
key: your_api_key
Notes
- Ensure that your API keys are kept secure and not exposed in your client-side code.
- The API follows standard HTTP status codes for success and error responses.
Contact
For further assistance, please contact our support team.