curl --request PATCH \
--url https://app.getcensus.com/api/v1/sources/{source_id}/filter_segments/{segment_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "priority accounts",
"molecules": [
{
"attribute": "last_seen_at",
"attribute_type": "property",
"operator": "isnotnull",
"value": "id"
}
]
}'
{
"status": "updated",
"data": {
"type": "segment",
"id": 18,
"name": "priority accounts",
"model_id": 9,
"dataset_id": 12,
"query": "SELECT * FROM (\n SELECT 1 AS id, 'Planet Express'::text AS company_name\n) AS census_1d19740e93f711b22efaea201fcf3f8f\nWHERE (\"id\" IS NOT NULL )\n",
"record_count": 12540,
"created_at": "2021-10-20T02:43:07.120Z",
"updated_at": "2021-10-20T02:50:35.477Z",
"resource_identifier": "segment:priority-accounts",
"molecules": [
{
"attribute": "last_seen_at",
"attribute_type": "property",
"operator": "isnotnull",
"value": "id"
}
],
"filter_segment_source_object_id": 32,
"cohorts": [
{
"id": 18,
"name": "Treatment A",
"percentage": 50,
"is_control": true,
"created_at": "2021-10-20T02:43:07.120Z",
"resource_identifier": "cohort:treatment-a"
}
]
}
}
Update certain values of a specified segment
curl --request PATCH \
--url https://app.getcensus.com/api/v1/sources/{source_id}/filter_segments/{segment_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "priority accounts",
"molecules": [
{
"attribute": "last_seen_at",
"attribute_type": "property",
"operator": "isnotnull",
"value": "id"
}
]
}'
{
"status": "updated",
"data": {
"type": "segment",
"id": 18,
"name": "priority accounts",
"model_id": 9,
"dataset_id": 12,
"query": "SELECT * FROM (\n SELECT 1 AS id, 'Planet Express'::text AS company_name\n) AS census_1d19740e93f711b22efaea201fcf3f8f\nWHERE (\"id\" IS NOT NULL )\n",
"record_count": 12540,
"created_at": "2021-10-20T02:43:07.120Z",
"updated_at": "2021-10-20T02:50:35.477Z",
"resource_identifier": "segment:priority-accounts",
"molecules": [
{
"attribute": "last_seen_at",
"attribute_type": "property",
"operator": "isnotnull",
"value": "id"
}
],
"filter_segment_source_object_id": 32,
"cohorts": [
{
"id": 18,
"name": "Treatment A",
"percentage": 50,
"is_control": true,
"created_at": "2021-10-20T02:43:07.120Z",
"resource_identifier": "cohort:treatment-a"
}
]
}
}
Bearer token for the current workspace. Can be retrieved from the Workspace's settings page.
Successfully updated the Segment
The response is of type object
.
Was this page helpful?