
Get DataFields
This document provides a guide and overview for the GetDataFields RPC, which allows you to get DataFields directly via API.
API Definition
POST https://apis.auxia.io/v1/GetDataFields
Entities
DataFieldParams
message DataFieldParams {
// Required
oneof params {
UserAttributeDataFieldParams user_attribute_data_field_params = 1;
TreatmentDataFieldParams treatment_data_field_params = 2;
EventDataFieldParams event_data_field_params = 3;
}
// User Attribute Params
message UserAttributeDataFieldParams{
// Required
string property_name = 1;
}
// Treatment Interaction Metrics Params
message TreatmentDataFieldParams {
// Required
TreatmentInteractionType treatment_interaction_type = 1;
// Optional
oneof aggregate_by {
string treatment_id = 2;
string surface_id = 3;
}
bool is_distinct_interaction = 4;
// Required
oneof aggregation {
DailyCountAggregation daily_count_aggregation = 5;
FirstTimestampAggregation first_timestamp_aggregation = 6;
LatestTimestampAggregation latest_timestamp_aggregation = 7;
DaysSinceFirstTimestampAggregation days_since_first_timestamp_aggregation = 8;
DaysSinceLastTimestampAggregation days_since_last_timestamp_aggregation = 9;
}
enum TreatmentInteractionType {
TREATMENT_INTERACTION_TYPE_UNSPECIFIED = 0;
SENT = 1;
VIEWED = 2;
CLICKED = 3;
SNOOZED = 4;
DISMISSED = 5;
CTA_COMPLETED = 6;
SWIPE = 7;
}
}
// Event Metric Params
message EventDataFieldParams {
// Required
string event_schema_name = 1;
// Optional
map<string, PropertyValuePb> property_value_by_property_name = 2;
// Required
oneof aggregation {
DailyCountAggregation daily_count_aggregation = 3;
FirstTimestampAggregation first_timestamp_aggregation = 4;
LatestTimestampAggregation latest_timestamp_aggregation = 5;
DaysSinceFirstTimestampAggregation days_since_first_timestamp_aggregation = 6;
DaysSinceLastTimestampAggregation days_since_last_timestamp_aggregation = 7;
}
}
// Property Value
message PropertyValuePb {
oneof property_value {
int64 long_value = 1;
double double_value = 2;
string string_value = 3;
bool boolean_value = 4;
google.protobuf.Timestamp timestamp_value = 5;
}
}
}
message FirstTimestampAggregation {}
message LatestTimestampAggregation {}
message DaysSinceFirstTimestampAggregation {}
message DaysSinceLastTimestampAggregation {}
ResolvedDataFieldPb
message ResolvedDataFieldPb {
int64 data_field_id = 1;
DataFieldParams data_field_params = 2;
string data_field_type = 3;
}
GetDataFields
API to get DataField Parameters
message GetDataFieldsByParamsRequest {
// Required
string project_id = 1;
// Required
repeated DataFieldParams data_field_params = 2;
}
message GetDataFieldsByParamsResponse {
repeated ResolvedDataFieldPb data_fields = 1;
}
Sample cURL Request
curl --location --request POST 'https://apis.auxia.io/v1/GetDataFields' \
--header 'Content-Type: application/json' \
--header 'x-api-key: API_KEY' \
--data-raw '{
"project_id": "PROJECT_ID",
"data_field_params": [
{
"treatment_data_field_params": {
"treatmentId": "TREATMENT_ID",
"treatment_interaction_type": "VIEWED",
"daily_count_aggregation": {
"window_name": "LAST_1D"
}
}
},
{
"event_data_field_params": {
"eventSchemaName": "Stream Finished",
"propertyValueByPropertyName": {
"duration_seconds": {
"long_value": 1800
},
"daily_count_aggregation": {
"window_name": "LAST_14D"
}
}
},
{
"user_attribute_data_field_params": {
"property_name": "signup_completed_timestamp_seconds"
}
}
]
}'
Sample Response
{
"dataFields": [
{
"dataFieldId": "1",
"dataFieldParams": {
"treatmentDataFieldParams": {
"treatmentInteractionType": "VIEWED",
"treatmentId": "TREATMENT_ID",
"dailyCountAggregation": {
"windowName": "LAST_1D"
}
}
},
"dataFieldType": "INTEGER"
},
{
"dataFieldId": "2",
"dataFieldParams": {
"eventDataFieldParams": {
"eventSchemaName": "Stream Finished",
"propertyValueByPropertyName": {
"duration_seconds": {
"longValue": 1800
}
},
"dailyCountAggregation": {
"windowName": "LAST_14D"
}
}
},
"dataFieldType": "INTEGER"
},
{
"dataFieldId": "3",
"dataFieldParams": {
"userAttributeDataFieldParams": {
"propertyName": "signup_completed_timestamp_seconds"
}
},
"dataFieldType": "TIMESTAMP_SECONDS"
}
]
}