{"_id":"564c431b61008d17006ffa46","category":{"_id":"564bbc7e8841060d00abb2ee","__v":10,"pages":["564bbf454bf5c80d0020901e","564bc1b08b1c5521002bb914","564c387b9baa330d00faa622","564c3a7b61008d17006ffa3a","564c3e4083b72c2b00b36fb6","564c431b61008d17006ffa46","564c4bc9b9cdb41700a0eae7","564c4e955f9d102b00fc3b4a","564c5f32c241881700d85981","564c68a93eb8f81700838a25"],"project":"54aa7f773b56130b0056c86e","version":"55781fe25129590d003ff4f7","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-11-17T23:47:10.058Z","from_sync":false,"order":1,"slug":"pulsate-cms-api","title":"Pulsate CMS API"},"editedParams2":true,"githubsync":"","parentDoc":null,"__v":6,"editedParams":true,"version":{"_id":"55781fe25129590d003ff4f7","project":"54aa7f773b56130b0056c86e","forked_from":"54aa7f773b56130b0056c871","__v":6,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z","categories":["55781fe35129590d003ff4f8","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","55781fe35129590d003ff4fb","55781fe35129590d003ff4fc","55781fe35129590d003ff4fd","55781fe35129590d003ff4fe","564bbc7e8841060d00abb2ee","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","582318b23b961a0f009516a1","594a848c9f4771001a43c959"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Developers","version_clean":"2.0.0","version":"2.0"},"project":"54aa7f773b56130b0056c86e","user":"54aa7f3f9bb00c0b00cb899b","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-11-18T09:21:31.903Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"curl -X POST \"https://control.pulsatehq.com/api/v1/apps/$APP_ID/segments\"\n  -H \"Authorization: Token token=$MY_ADMIN_API_TOKEN\"\n  -d '{\n      \"segment\": {\n          \"name\": \"new_segment_name\",\n          \"groups\": [\n              {\n                  \"rules\": [\n                      {\n                        \"time_frame\": \"\",\n                        \"match_type\": \"less\",\n                        \"match_value\": \"123\",\n                        \"match_end_value\": \"\",\n                        \"event_resource_type\": \"geofence\",\n                        \"event_resource\": {\n                          \"guid\": \"QrqsYSC4\"\n                        },\n                        \"type\": \"number_of_visits\"\n                      }\n                  ]\n              }\n          ]\n      }\n  }'","name":"","language":"shell"}]},"method":"post","results":{"codes":[{"status":200,"name":"","code":"{\n  \"segment\": {\n    \"name\": \"new_segment_name\",\n    \"groups\": [\n      {\n        \"rules\": [\n          {\n            \"time_frame\": \"\",\n            \"match_type\": \"less\",\n            \"match_value\": \"123\",\n            \"match_end_value\": \"\",\n            \"event_resource_type\": \"geofence\",\n            \"event_resource\": {\n              \"guid\": \"QrqsYSC4\"\n            },\n            \"type\": \"number_of_visits\"\n          }\n        ]\n      }\n    ],\n    \"id\": \"587650da636f6e3a0c0b0500\"\n  }\n}","language":"json"}]},"settings":"564bbbf80cbcc91700b8171c","auth":"required","params":[{"_id":"57ff8296159c7e0e003c4825","ref":"","in":"path","required":true,"desc":"App ID. It can be fetched by using \"Apps: Get All (Index)\" or \"Apps: Get One (Show)\" endpoints.","default":"","type":"string","name":"app_id"},{"_id":"564c431b61008d17006ffa47","ref":"","in":"body","required":true,"desc":"Segment to be created","default":"","type":"object","name":"segment"},{"_id":"587653c2bed1710f00f9eb43","ref":"","in":"body","required":false,"desc":"Name of the segment","default":"","type":"string","name":"segment.name"},{"_id":"587653c2bed1710f00f9eb42","ref":"","in":"body","required":false,"desc":"Array of groups for segment","default":"","type":"array_object","name":"segment.groups"},{"_id":"587653c2bed1710f00f9eb41","ref":"","in":"body","required":false,"desc":"Array of rules for group","default":"","type":"array_object","name":"segment.groups[].rules"},{"_id":"587653c2bed1710f00f9eb40","ref":"","in":"body","required":false,"desc":"Type for the rule, use /api/v1/apps/:app_id/segments/rules for available rules types","default":"","type":"string","name":"segment.groups[].rules[].type"},{"_id":"587653c2bed1710f00f9eb3f","ref":"","in":"body","required":false,"desc":"Time frame for the rule, can be one of: ['', 'minutes', 'hours', 'days', 'weeks', 'months', 'years']","default":"","type":"string","name":"segment.groups[].rules[].time_frame"},{"_id":"587653c2bed1710f00f9eb3e","ref":"","in":"body","required":false,"desc":"Match type for the rule, use /api/v1/apps/:app_id/segments/rules for available rules match types","default":"","type":"string","name":"segment.groups[].rules[].match_type"},{"_id":"587653c2bed1710f00f9eb3d","ref":"","in":"body","required":false,"desc":"Match value for the rule","default":"","type":"string","name":"segment.groups[].rules[].match_value"},{"_id":"587653c2bed1710f00f9eb3c","ref":"","in":"body","required":false,"desc":"Match end value for the rule. Combined with match_value can be use for \"between\" rule","default":"","type":"string","name":"segment.groups[].rules[].match_end_value"},{"_id":"587653c2bed1710f00f9eb3b","ref":"","in":"body","required":false,"desc":"Event resource type for the rule, can be one of: ['', 'beacon', 'geofence']","default":"","type":"string","name":"segment.groups[].rules[].event_resource_type"},{"_id":"587653c2bed1710f00f9eb3a","ref":"","in":"body","required":false,"desc":"Event resource for the rule","default":"","type":"object","name":"segment.groups[].rules[].event_resource"},{"_id":"587653c2bed1710f00f9eb39","ref":"","in":"body","required":false,"desc":"Geofence guid for the event resource","default":"","type":"string","name":"segment.groups[].rules[].event_resource.guid"},{"_id":"587653c2bed1710f00f9eb38","ref":"","in":"body","required":false,"desc":"Beacons UUID for the event resource","default":"","type":"string","name":"segment.groups[].rules[].event_resource.guid"},{"_id":"587653c2bed1710f00f9eb37","ref":"","in":"body","required":false,"desc":"Beacons major for the event resource","default":"","type":"string","name":"segment.groups[].rules[].event_resource.major"},{"_id":"587653c2bed1710f00f9eb36","ref":"","in":"body","required":false,"desc":"Beacons minor for the event resource","default":"","type":"string","name":"segment.groups[].rules[].event_resource.minor"},{"_id":"599fe9c3f1d56f000f243467","ref":"","in":"body","required":false,"desc":"Group id, used for targeting groups of resources.","default":"","type":"string","name":"segment.groups[].rules[].event_resource.id"},{"_id":"587653c2bed1710f00f9eb35","ref":"","in":"body","required":false,"desc":"Locations for the rule","default":"","type":"array_object","name":"segment.groups[].rules[].locations"},{"_id":"587653c2bed1710f00f9eb34","ref":"","in":"body","required":false,"desc":"Values for the locations","default":"","type":"array_object","name":"segment.groups[].rules[].locations[].values"},{"_id":"587653c2bed1710f00f9eb33","ref":"","in":"body","required":false,"desc":"Center location of geofence circle as [longitude, latitude]","default":"","type":"array_double","name":"segment.groups[].rules[].locations[].values.center"},{"_id":"587653c2bed1710f00f9eb32","ref":"","in":"body","required":false,"desc":"Radius for the values in meters","default":"","type":"string","name":"segment.groups[].rules[].locations[].values.radius"},{"_id":"587653c2bed1710f00f9eb31","ref":"","in":"body","required":false,"desc":"Type of the value, can be one of: ['point']","default":"","type":"string","name":"segment.groups[].rules[].locations[].values.type"}],"url":"/apps/:app_id/segments"},"isReference":true,"order":50,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Segment anatomy\",\n  \"body\": \"Pulsate Segment is a tool of grouping users matching a specified criteria list. It consists of one or more groups, which in turn consist of one or more rules.\\n\\nTo be matched by a segment group, user has to fulfill any of the criteria specified by its rules. However, to belong to a segment, user has to be matched by all of its groups.\\n\\n**Example**\\nLet's say one wants to create a segment that matches all users named \\\"Phil\\\" or \\\"Mark\\\", who entered a specified geofence twice. It would have two groups, one containing two rules: \\\"first name is Phil\\\" and \\\"first name is Mark\\\", second one containing just one rule: \\\"been at geofence two times\\\".\"\n}\n[/block]","excerpt":"","slug":"segments-create-one","type":"endpoint","title":"Segments: Create One"}

postSegments: Create One


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

app_id:
required
string
App ID. It can be fetched by using "Apps: Get All (Index)" or "Apps: Get One (Show)" endpoints.

Body Params

segment:
required
object
Segment to be created
segment.name:
string
Name of the segment
segment.groups:
array of objects
Array of groups for segment
segment.groups[].rules:
array of objects
Array of rules for group
segment.groups[].rules[].type:
string
Type for the rule, use /api/v1/apps/:app_id/segments/rules for available rules types
segment.groups[].rules[].time_frame:
string
Time frame for the rule, can be one of: ['', 'minutes', 'hours', 'days', 'weeks', 'months', 'years']
segment.groups[].rules[].match_type:
string
Match type for the rule, use /api/v1/apps/:app_id/segments/rules for available rules match types
segment.groups[].rules[].match_value:
string
Match value for the rule
segment.groups[].rules[].match_end_value:
string
Match end value for the rule. Combined with match_value can be use for "between" rule
segment.groups[].rules[].event_resource_type:
string
Event resource type for the rule, can be one of: ['', 'beacon', 'geofence']
segment.groups[].rules[].event_resource:
object
Event resource for the rule
segment.groups[].rules[].event_resource.guid:
string
Geofence guid for the event resource
segment.groups[].rules[].event_resource.guid:
string
Beacons UUID for the event resource
segment.groups[].rules[].event_resource.major:
string
Beacons major for the event resource
segment.groups[].rules[].event_resource.minor:
string
Beacons minor for the event resource
segment.groups[].rules[].event_resource.id:
string
Group id, used for targeting groups of resources.
segment.groups[].rules[].locations:
array of objects
Locations for the rule
segment.groups[].rules[].locations[].values:
array of objects
Values for the locations
segment.groups[].rules[].locations[].values.center:
array of doubles
Center location of geofence circle as [longitude, latitude]
segment.groups[].rules[].locations[].values.radius:
string
Radius for the values in meters
segment.groups[].rules[].locations[].values.type:
string
Type of the value, can be one of: ['point']

Examples


Result Format


Documentation

[block:callout] { "type": "info", "title": "Segment anatomy", "body": "Pulsate Segment is a tool of grouping users matching a specified criteria list. It consists of one or more groups, which in turn consist of one or more rules.\n\nTo be matched by a segment group, user has to fulfill any of the criteria specified by its rules. However, to belong to a segment, user has to be matched by all of its groups.\n\n**Example**\nLet's say one wants to create a segment that matches all users named \"Phil\" or \"Mark\", who entered a specified geofence twice. It would have two groups, one containing two rules: \"first name is Phil\" and \"first name is Mark\", second one containing just one rule: \"been at geofence two times\"." } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}