Skip to main content

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",
"typeName": "string",
"payload": "object"
}

Parameters

ParameterTypeRequiredDescription
loggingTokenstringYesYour app's event logging token
typeIdstringNo*The ID of the event type you want to log
typeNamestringNo*The name of the new event type to be created
payloadobjectYesAny valid JSON object containing the event data

Note: Either typeId or typeName must be provided.

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

Event Type Creation

If you want to create a new event type dynamically, you can provide the typeName field instead of a typeId. This will create a new event type with the specified name.

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.