I would like to:
- Add custom property.
- Get value of that property using REST API.
How can I do this?
I would like to:
How can I do this?
Just to confirm you are talking about Custom Properties, not just a property that exists on a given event.
The custom property only exists in our Modeling layer, that is to say only through a UI based API request. Any raw export or lower level api request would not include said custom property.
To be clear, using custom properties in an API request is not extremely user friendly, here is a sample regex extraction query used in an Insights report for example: (Most of the structure is to replicate the UI state of the query builder so can change from query to query)
{
"bookmark": {
"icon": "line",
"sections": {
"show": [
{
"dataset": "$mixpanel",
"value": {
"name": "test",
"resourceType": "events"
},
"resourceType": "events",
"profileType": null,
"search": "",
"dataGroupId": null,
"math": "total",
"perUserAggregation": null,
"property": null
}
],
"cohorts": [],
"group": [
{
"dataset": "$mixpanel",
"customProperty": {
"composedProperties": {
"A": {
"label": "amount",
"propertyDefaultType": "string",
"resourceType": "event",
"type": "string",
"value": "amount"
}
},
"description": "",
"displayFormula": "REGEX_EXTRACT( A , \"[0-9\\\\.]*\")",
"name": "Custom breakdown 1",
"resourceType": "events",
"propertyType": "string"
},
"customPropertyId": "$temp-cke329nr000a53j6c2rfhg3zy",
"value": "Custom breakdown 1",
"resourceType": "events",
"profileType": null,
"search": "",
"dataGroupId": null,
"propertyType": "string",
"typeCast": null,
"unit": null
}
],
"filter": [],
"formula": [],
"time": [
{
"dateRangeType": "in the last",
"window": {
"unit": "day",
"value": 30
},
"unit": "day"
}
]
},
"columnWidths": {
"bar": {}
},
"displayOptions": {
"chartType": "line",
"plotStyle": "standard",
"analysis": "linear",
"value": "absolute"
},
"sorting": {
"bar": {
"sortBy": "column",
"colSortAttrs": [
{
"sortBy": "value",
"sortOrder": "desc"
},
{
"sortBy": "value",
"sortOrder": "desc"
},
{
"sortBy": "value",
"sortOrder": "desc"
}
]
},
"line": {
"sortBy": "value",
"sortOrder": "desc"
},
"table": {
"sortBy": "column",
"colSortAttrs": [
{
"sortBy": "label",
"sortOrder": "asc"
},
{
"sortBy": "label",
"sortOrder": "asc"
},
{
"sortBy": "label",
"sortOrder": "asc"
}
]
}
},
"title": ""
},
"use_query_cache": true,
"tracking_props": {
"is_main_query_for_report": true,
"query_reason": "qb_other_update",
"report_name": "insights"
}
}
Is there something specific you are looking to accomplish with the API export that couldn’t be accomplished with Raw Export and applying the transformation in a tool you are more comfortable with?
Thansk,
Emmett
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.