Event Schemas
Update an event schema
Update an event schema and add new attributes and dimensions
Once an event schema is activated, you cannot update or delete existing attributes and dimensions however you can add new attributes and dimensions and update event schema description.
operationId: updateEventSchema
PATCH
/
event_schema
/
{event_schema_name}
curl --request PATCH \
--url https://api.togai.com/event_schema/{event_schema_name} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"description": "Cab ride completed",
"status": "DRAFT",
"attributes": [
{
"name": "distance"
},
{
"name": "time"
}
],
"dimensions": [
{
"name": "city"
},
{
"name": "vehicle_type"
}
],
"enrichments": {
"dependencies": [
{
"type": "SETTING",
"key": "setting.user.meters_per_km",
"name": "meters_per_km"
}
],
"fields": [
{
"name": "distanceInKM",
"type": "ATTRIBUTE",
"enrichmentType": "JSON_LOGIC",
"value": "{\"/\":[{\"var\":[\"attribute.distance\"]},{\"var\":[\"dependencies.meters_per_km\"]}]}",
"order": 1
},
{
"name": "rideType",
"type": "DIMENSION",
"enrichmentType": "JSON_LOGIC",
"value": "{\"if\":[{\"<=\":[100,{\"var\":[\"attribute.distanceInKM\"]}]},\"long_distance\",\"short_distance\"]}",
"order": 2
}
]
}
}'
{
"name": "ride_completed",
"description": "Cab ride completed",
"version": 1,
"status": "DRAFT",
"attributes": [
{
"name": "distance"
},
{
"name": "time"
}
],
"dimensions": [
{
"name": "city"
},
{
"name": "ride_type"
}
],
"featureDetails": {
"featureId": "feature.1122.ahoiud",
"attributeName": "distance"
},
"eventLevelRevenue": false
}
Authorizations
Authorization
string
headerrequiredBearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
event_schema_name
string
requiredBody
application/json
description
string
Description of the event
attributes
object[]
dimensions
object[]
enrichments
object
Response
200 - application/json
name
string
requiredName of the event. Must be unique for an organization.
description
string
Description of the event
version
integer
requiredVersion of event schema
status
enum<string>
Status of event schema
- DRAFT - Schema is in draft state
- ACTIVE - Schema is currently active
- INACTIVE - Schema is currently inactive
- ARCHIVED - Older version of event schema
Available options:
DRAFT
, ACTIVE
, INACTIVE
, ARCHIVED
attributes
object[]
dimensions
object[]
featureDetails
object
details of feature associated with event schema with attribute name
enrichments
object
eventLevelRevenue
boolean
createdAt
string
updatedAt
string
curl --request PATCH \
--url https://api.togai.com/event_schema/{event_schema_name} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"description": "Cab ride completed",
"status": "DRAFT",
"attributes": [
{
"name": "distance"
},
{
"name": "time"
}
],
"dimensions": [
{
"name": "city"
},
{
"name": "vehicle_type"
}
],
"enrichments": {
"dependencies": [
{
"type": "SETTING",
"key": "setting.user.meters_per_km",
"name": "meters_per_km"
}
],
"fields": [
{
"name": "distanceInKM",
"type": "ATTRIBUTE",
"enrichmentType": "JSON_LOGIC",
"value": "{\"/\":[{\"var\":[\"attribute.distance\"]},{\"var\":[\"dependencies.meters_per_km\"]}]}",
"order": 1
},
{
"name": "rideType",
"type": "DIMENSION",
"enrichmentType": "JSON_LOGIC",
"value": "{\"if\":[{\"<=\":[100,{\"var\":[\"attribute.distanceInKM\"]}]},\"long_distance\",\"short_distance\"]}",
"order": 2
}
]
}
}'
{
"name": "ride_completed",
"description": "Cab ride completed",
"version": 1,
"status": "DRAFT",
"attributes": [
{
"name": "distance"
},
{
"name": "time"
}
],
"dimensions": [
{
"name": "city"
},
{
"name": "ride_type"
}
],
"featureDetails": {
"featureId": "feature.1122.ahoiud",
"attributeName": "distance"
},
"eventLevelRevenue": false
}