Complete Example — Event Lifecycle - Events Platform
Complete Example — Event Lifecycle
Generate a KS with userId via session.start (see Session Guide) and set the shell variables:
# Prerequisites: set these shell variables before running the commands below
# KALTURA_EVENTS_API_URL="https://events-api.nvp1.ovp.kaltura.com/api/v1"
# KALTURA_KS="<your KS with userId>"
# --- Step 1: Create an event ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/create" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d '{
"name": "API Demo Event",
"templateId": "tm0000",
"startDate": "2024-12-22T15:00:00.000Z",
"endDate": "2024-12-22T17:00:00.000Z",
"timezone": "America/New_York",
"description": "Created via Events Platform API"
}'
# Save the "id" from the response as EVENT_ID
# --- Step 2: Add a live webcast session ---
curl -X POST "$KALTURA_EVENTS_API_URL/sessions/create" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d "{
\"eventId\": $EVENT_ID,
\"session\": {
\"name\": \"Main Stage\",
\"type\": \"LiveWebcast\",
\"startDate\": \"2024-12-22T15:00:00.000Z\",
\"endDate\": \"2024-12-22T17:00:00.000Z\",
\"visibility\": \"published\"
}
}"
# --- Step 3: List all events ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/list" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d '{
"filter": {"searchTerm": " "},
"orderBy": "-startDate",
"pager": {"offset": 0, "limit": 15}
}'
# --- Step 4: Update the event ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/update" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d "{
\"id\": $EVENT_ID,
\"name\": \"Updated API Demo Event\",
\"labels\": [\"demo\", \"api-test\"]
}"
# --- Step 5: Delete the event ---
curl -X POST "$KALTURA_EVENTS_API_URL/events/delete" \
-H "Authorization: Bearer $KALTURA_KS" \
-H "Content-Type: application/json" \
-d "{\"id\": $EVENT_ID}"