create_event
This endpoint is used to create and log new events in your application.
Endpoint
POST https://api.sedl.dev/public/create_event
Request Body
Request Structure
{
"loggingToken": "string",
"typeId": "string",
"payload": "object"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
loggingToken | string | Yes | Your app's event logging token |
typeId | string | Yes | The ID of the event type you want to log |
payload | object | Yes | Any valid JSON object containing the event data |
Example Request
cURL Example
curl -X POST https://api.sedl.dev/public/create_event \
-H "Content-Type: application/json" \
-d '{
"loggingToken": "f565c835ef40673f1a67f15d294f3e9d",
"typeId": "038c6337-d021-4767-89f9-1e59e49fe475",
"payload": {
"userId": "12345",
"action": "button_click",
"buttonId": "checkout",
"timestamp": "2023-10-24T10:30:00Z",
"metadata": {
"page": "product-details",
"product_id": "prod_789"
}
}
}'
Response
Success Response
Status Code: 201 Created
Success Response
{
"success": true,
"eventId": "evt_abc123def456",
"message": "Event logged successfully",
"timestamp": "2023-10-24T10:30:05Z"
}
Error Responses
Status Code: 400 Bad Request
Invalid Request
{
"success": false,
"error": "Invalid request body",
"details": "Missing required field: loggingToken"
}
Status Code: 401 Unauthorized
Invalid Token
{
"success": false,
"error": "Invalid logging token",
"details": "The provided logging token is not valid"
}
Status Code: 404 Not Found
Invalid Event Type
{
"success": false,
"error": "Event type not found",
"details": "The specified typeId does not exist"
}
Notes
Payload Flexibility
The payload field accepts any valid JSON structure, giving you complete freedom to log whatever data is relevant to your application.
Rate Limiting
This endpoint may be subject to rate limiting. Ensure your application handles potential 429 (Too Many Requests) responses appropriately.