post https://{regionAndDomain}.com/api/app/projects//schemas//
Upload a schema for a single entity. If a schema already exists for a specified entity, it will be replaced by the one you upload.
Metadata merging behavior
If the new schema is missing
metadata
properties that are currently set in the existing schema for that entity, those properties will be merged into the new schema. For example, if your current schema has{"metadata": {"com.mixpanel": {"hidden": true}}}
and you upload a new schema without "hidden", we will merge"hidden": true
to your uploaded schema's metadata. If you want to remove that property, set the value tonull
.
Adding a schema for User Profiles
To add a schema for your User Profiles, specify the
entityType
asprofile
and thename
as$user
.
Example POST Body
{
"$schema": "http://json-schema.org/draft-07/schema",
"description": "Tracked when a user adds an item to their cart.",
"required": [
"item_name",
"item_id",
"item_price"
],
"additionalProperties": true,
"metadata": {
"com.mixpanel": {
"tags": [
"Shopping",
"KPIs"
],
"displayName": "Item Purchased",
"hidden": false,
"dropped": false,
"owners": [
{
"name": "Pat Davis",
"email": "[email protected]"
}
]
}
},
"properties": {
"item_name": {
"type": "string",
"description": "The name of the item",
"examples": [
"Blue Widget"
],
"metadata": {
"com.mixpanel": {
"displayName": "Item Name"
}
}
},
"item_id": {
"type": "integer",
"description": "The internal id of the item",
"examples": [
12345
],
"metadata": {
"com.mixpanel": {
"displayName": "Item ID"
}
}
},
"item_price": {
"type": "number",
"description": "The current price of the item",
"examples": [
25.35
],
"metadata": {
"com.mixpanel": {
"displayName": "Price"
}
}
},
"promo_id": {
"type": "integer",
"description": "The id of any promo in progress for this item",
"examples": [
82523,
18382
],
"metadata": {
"com.mixpanel": {
"displayName": "Promo ID"
}
}
},
"date_added_to_catalog": {
"type": "string",
"format": "date-time",
"description": "The date this item was added to the store catalog",
"examples": [
"2015-03-05T15:25:23"
],
"metadata": {
"com.mixpanel": {
"displayName": "Date Added"
}
}
}
}
} ```