MeiroDocs

Segments

+ Parameters

Section: Group Segments. Base URL: https://instance_name.meiro.io/api/.

Segments [/segments{?limit,offset,order_by,order_dir,name_filter,tag_ids,show_my,show_shared_with_me,show_foreign,load_full_structure}]

List All Segments [GET]

  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • order_by (string, optional) - Ordered column name
    • order_dir (string, optional) - Ordering direction
    • name_filter (string, optional) - Segments' name filter
    • tag_ids (array, optional) - Segments' tags filter
    • show_my (number, optional) - Show my segments filter flag
    • show_shared_with_me (number, optional) - Show segments shared with me filter flag
    • show_foreign (number, optional) - Show foreign segments filter flag
    • load_full_structure (number, optional) - Full data structure return flag
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segments": [
        {
            "id": 100,
            "user_id": 200,
            "name": "example segment",
            "description": "segment description",
            "settings": {
                "conditions_operation": {
                    "operation": "and",
                    "operands": [
                        {
                            "operation": "or",
                            "operands": [
                                {
                                    "attribute_id": "attribute_1",
                                    "condition": {
                                        "operation": "contains",
                                        "value": "foo"
                                    },
                                    "negation": false
                                },
                                {
                                    "attribute_id": "attribute_2",
                                    "condition": {
                                        "operation": "equals",
                                        "value": "bar"
                                    },
                                    "negation": false
                                }
                            ],
                            "negation": false
                        },
                        {
                            "attribute_id": "attribute_3",
                            "condition": {
                                "operation": "contains",
                                "value": "bar"
                            },
                            "negation": false
                        ],
                        "negation": false
                    }
                },
                "destination_parameters": {
                    "1001": {
                        "parameter_1": "test_value_1",
                        "parameter_2": "test_value_2"
                    }
                }
            },
            "frontend_settings": {},
            "disabled": 0,
            "deleted": 0,
            "segment_type": "custom",
            "created": "2017-01-01 15:35:00",
            "tags": [],
            "author_id": 300,
            "origin_created": "2017-01-01 15:35:00",
            "last_export": "2017-01-01 16:35:00",
            "data_load_start_time": null,
            "data_load_end_time": null,
            "customers_count": 420,
            "schedules": []
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "order_by": "id",
        "order_dir": "ASC",
        "name_filter": null,
        "tag_ids": null,
        "show_my": 1,
        "show_shared_with_me": 1
        "show_foreign": 0
    }
}

Create a Segment [POST]

Required feature: segments/create

Operations for string attribute data types:

  • equals (expects single string value)
  • not_equal (expects single string value)
  • contains (expects single string value)
  • not_contain (expects single string value)
  • in (expects list of string values)
  • not_in (expects list of string values)
  • contains_any_of (expects list of string values)
  • not_contain_any_of (expects list of string values)

Operations for numeric attribute data types:

  • number_equals (expects single numeric value)
  • number_not_equal (expects single numeric value)
  • number_lower_than (expects single numeric value)
  • number_greater_than (expects single numeric value)
  • number_between (expects list of 2 numeric values)
  • number_in (expects list of numeric values)
  • number_not_in (expects list of numeric values)

Operations for date attribute data types:

  • date_equals (expects single date value)
  • date_lower_than (expects single date value)
  • date_greater_than (expects single date value)
  • date_between (expects list of 2 date values)
  • date_matches_current_day (no value expected)
  • date_matches_current_month (no value expected)
  • date_matches_current_year (no value expected)

Operations for boolean attribute data types:

  • is_true (no value expected)
  • is_false (no value expected)

Operations for all attribute data types:

  • is_set (no value expected)
  • is_not_set (no value expected)
  • Parameters

    • load_full_structure (number, optional) - Full data structure return flag
  • Attributes

    • name: example segments (string)
    • settings: {} (string) - optional (json)
    • frontend_settings: {} (string) - optional (json)
    • description: segment description (string) - optional
    • segment_type: custom - optional
    • disabled: 0 (number) - optional
    • tag_ids (array, optional)
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 201 (application/json)

{
    "segment": {
        "id": 100,
        "user_id": 200,
        "name": "example segment",
        "description": "segment description",
        "settings": {},
        "frontend_settings": {},
        "disabled": 0,
        "deleted": 0,
        "segment_type": "custom",
        "created": "2017-01-01 15:35:00",
        "author_id": 200,
        "origin_created": "2017-01-01 15:35:00",
        "last_export": null,
        "data_load_start_time": null,
        "data_load_end_time": null,
        "schedules": []
    }
}

All Segments [/all_segments{?only_with_view_access}]

List All Segments Base Info [GET]

  • Parameters

    • only_with_view_access (number, optional) - Segments with user view access flag
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segments": [
        {
            "id": 100,
            "name": "example segment",
            "type": "custom"
        }
    ]
}

Segment [/segments/{segment_id}{?load_full_structure}]

  • Parameters
    • load_full_structure (number, optional) - Full data structure return flag

Retrieve a Segment [GET]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/view

  • foreign_segments/edit

  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segment": {
        "id": 100,
        "user_id": 200,
        "name": "example segment",
        "description": "segment description",
        "settings": {
            "destination_parameters": {
                "1001": {
                    "parameter_1": "test_value_1",
                    "parameter_2": "test_value_2"
                }
            }
        },
        "frontend_settings": {},
        "disabled": 0,
        "deleted": 0,
        "segment_type": "custom",
        "created": "2017-01-01 15:35:00",
        "tags": [],
        "author_id": 300,
        "origin_created": "2017-01-01 15:35:00",
        "last_export": "2017-01-01 16:35:00",
        "data_load_start_time": null,
        "data_load_end_time": null,
        "schedules": []
    }
}

Modify a Segment [PATCH]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/edit

  • Attributes

    • name: example segment (string) - optional
    • settings: {} (string) - optional (json)
    • frontend_settings: {} (string) - optional (json)
    • description: segment description (string) - optional
    • disabled: 0 (number) - optional
    • tag_ids (array, optional)
    • schedules (array[SegmentExportDestinationSchedule], optional)
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segment": {
        "id": 100,
        "user_id": 200,
        "name": "example segment",
        "description": "segment description",
        "settings": {
            "conditions_operation": {
                "conditions": [
                    {
                        "operation": "equals",
                        "value": "Tablet"
                    }
                ],
                "attribute_id": "snowplow_libib_device_last",
                "negation": false
            },
            "destination_parameters": {
                "1001": {
                    "parameter_1": "test_value_1",
                    "parameter_2": "test_value_2"
                }
            }
        },
        "frontend_settings": {},
        "disabled": 0,
        "deleted": 0,
        "segment_type": "custom",
        "created": "2017-01-01 15:35:00",
        "tags": [],
        "author_id": 300,
        "origin_created": "2017-01-01 15:35:00",
        "last_export": "2017-01-01 16:35:00",
        "data_load_start_time": null,
        "data_load_end_time": null,
        "schedules": [
            {
                "destination_id": 2,
                "schedule_type": "repetitive",
                "schedules": [
                    {
                        "minute": "*/5",
                        "hour": "*",
                        "day": "*",
                        "month": "*",
                        "day_of_week": "*"
                    }
                ]
            }
        ]
    }
}

Delete a Segment [DELETE]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/edit

  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "message": "OK"
}
  • Response 400 (application/json)
{
    "message": "The segment can't be deleted as it's currently in use by the following email campaign(s):",
    "error_type": "segment_used_in_email",
    "emails": [{"id": "email_id", "name": "Email Name"}]
}
  • Response 400 (application/json)
{
    "message": "The segment can't be deleted as it's currently in use by the following mobile push notification(s):",
    "error_type": "segment_used_in_push_notification",
    "push_notifications": [{"id": "push_id", "name": "Mobile Push Name"}]
}
  • Response 400 (application/json)
{
    "message": "The segment can't be deleted as it's currently in use by the following WhatsApp campaign(s):",
    "error_type": "segment_used_in_whatsapp_campaign",
    "whatsapp_campaigns": [{"id": "wa_campaign_id", "name": "Whatsapp Campaign Name"}]
}
  • Response 400 (application/json)
{
    "message": "The segment can't be deleted as it's currently in use by the following journey(s):",
    "error_type": "segment_used_in_journey",
    "journeys": [{"id": "journey_id", "name": "Journey Name"}]
}
  • Response 400 (application/json)
{
    "message": "The segment can't be deleted as it's currently in use by the following native banner(s):",
    "error_type": "segment_used_in_embedded_web_banner",
    "embedded_web_banners": [{"id": "banner_id", "name": "Banner Name"}]
}
  • Response 400 (application/json)
{
    "message": "The segment can't be deleted as it's currently in use by the following pop-up banner(s):",
    "error_type": "segment_used_in_popup_web_banner",
    "popup_web_banners": [{"id": "banner_id", "name": "Banner Name"}]
}

Clone Segment [POST]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/edit

  • Attributes

    • segment_type: custom
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segment": {
        "id": 100,
        "user_id": 200,
        "name": "clone_example segment",
        "description": "segment description",
        "settings": {},
        "disabled": 0,
        "deleted": 0,
        "segment_type": "custom",
        "created": "2017-01-01 15:35:00",
        "tags": [],
        "author_id": 300,
        "origin_created": "2017-01-01 15:35:00",
        "last_export": null,
        "data_load_start_time": null,
        "data_load_end_time": null,
        "schedules": []
    }
}

Segment's History List [/segments/{segment_id}/history{?limit,offset,order_by,order_dir,load_full_structure}]

Retrieve a Segment's History List [GET]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/view

  • foreign_segments/edit

  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • order_by (string, optional) - Ordered column name
    • order_dir (string, optional) - Ordering direction
    • load_full_structure (number, optional) - Full data structure return flag
  • Request

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "history_list": [
        {
            "id": null,
            "segment": {
                "id": 200,
                "user_id": 300,
                "name": "example segment",
                "description": "segment description",
                "settings": {},
                "frontend_settings": {},
                "disabled": 0,
                "deleted": 0,
                "segment_type": "custom",
                "created": "2017-01-01 15:35:00",
                "schedules": []
            }
        },
        {
            "id": "100",
            "segment": {
                "id": 200,
                "user_id": 300,
                "name": "test",
                "description": "segment description",
                "settings": {},
                "frontend_settings": {},
                "disabled": 0,
                "deleted": 0,
                "segment_type": "custom",
                "created": "2017-01-01 11:35:00",
                "schedules": []
            }
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "order_by": "id",
        "order_dir": "ASC"
    }
}

Segment's History Item [/segments/{segment_id}/history/{history_id}{?load_full_structure}]

Retrieve a Segment's History Item [GET]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/view

  • foreign_segments/edit

  • Request

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "history": {
        "id": "100",
        "segment": {
            "id": 200,
            "user_id": 300,
            "name": "example segment",
            "description": "segment description",
            "settings": {},
            "frontend_settings": {},
            "disabled": 0,
            "deleted": 0,
            "segment_type": "custom",
            "created": "2017-01-01 15:35:00"
        },
        "diff": {
            "name": {
                "from": "test",
                "to": "example segment"
            }
        }
    }
}

Revert a Segment's History Item [PATCH]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/edit

  • Request

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segment": {
        "id": 100,
        "user_id": 200,
        "name": "example segment",
        "description": "segment description",
        "settings": {},
        "frontend_settings": {},
        "disabled": 0,
        "deleted": 0,
        "segment_type": "custom",
        "created": "2017-01-01 15:35:00"
    }
}

Trashed Segments [/segments/trash{?limit,offset,searched_text}]

List All Trashed Segments [GET]

  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • searched_text (string, optional) - Searched items' name
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "trashed_segments": [
        {
            "id": 100,
            "user_id": 200,
            "name": "example segment",
            "description": "segment description",
            "settings": {},
            "disabled": 0,
            "deleted": 1,
            "segment_type": "custom",
            "created": "2017-01-01 15:35:00"
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "searched_text": "example"
    }
}
  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • searched_text (string, optional) - Searched items' name
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "trashed_featured_segments": [
        {
            "id": 100,
            "user_id": 200,
            "name": "example segment",
            "description": "segment description",
            "settings": {},
            "disabled": 0,
            "deleted": 1,
            "segment_type": "featured",
            "created": "2017-01-01 15:35:00"
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "searched_text": "example"
    }
}

Trashed Smart Segments [/smart_segments/trash{?limit,offset,searched_text}]

List All Trashed Smart Segments [GET]

  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • searched_text (string, optional) - Searched items' name
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "trashed_smart_segments": [
        {
            "id": 100,
            "user_id": 200,
            "name": "example segment",
            "description": "segment description",
            "settings": {},
            "disabled": 0,
            "deleted": 1,
            "segment_type": "smart",
            "created": "2017-01-01 15:35:00"
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "searched_text": "example"
    }
}

Trashed Segment [/segments/trash/{segment_id}]

Restore a Trashed Segment [PATCH]

Required feature (one of):

  • Segment ACL authorization

  • foreign_segments/edit

  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "segment": {
        "id": 100,
        "user_id": 200,
        "name": "example segment",
        "description": "segment description",
        "settings": {},
        "disabled": 0,
        "deleted": 0,
        "segment_type": "custom",
        "created": "2017-01-01 15:35:00"
    }
}

Smart Segments [/smart_segments{?limit,offset,order_by,order_dir,load_full_structure}]

List All Smart Segments [GET]

  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • order_by (string, optional) - Ordered column name
    • order_dir (string, optional) - Ordering direction
    • load_full_structure (number, optional) - Full data structure return flag
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "smart_segments": [
        {
            "id": 100,
            "user_id": 200,
            "name": "example segment",
            "description": "segment description",
            "settings": {
                "destination_parameters": {
                    "1001": {
                        "parameter_1": "test_value_1",
                        "parameter_2": "test_value_2"
                    }
                }
            },
            "frontend_settings": {},
            "disabled": 0,
            "deleted": 0,
            "segment_type": "smart",
            "created": "2017-01-01 15:35:00",
            "schedules": []
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "order_by": "id",
        "order_dir": "ASC"
    }
}

Required feature: featured_segments/list

  • Parameters

    • limit (number, optional) - Limit of the number of records returned
    • offset (number, optional) - Offset for the number of records returned
    • order_by (string, optional) - Ordered column name
    • order_dir (string, optional) - Ordering direction
    • load_full_structure (number, optional) - Full data structure return flag
  • Request (application/json)

    • Headers

      X-Access-Token: 1234567890abcdef

  • Response 200 (application/json)

{
    "featured_segments": [
        {
            "id": 100,
            "user_id": 200,
            "name": "example segment",
            "description": "segment description",
            "settings": {
                "destination_parameters": {
                    "1001": {
                        "parameter_1": "test_value_1",
                        "parameter_2": "test_value_2"
                    }
                }
            },
            "frontend_settings": {},
            "disabled": 0,
            "deleted": 0,
            "segment_type": "featured",
            "created": "2017-01-01 15:35:00",
            "tags": [],
            "author_id": 300,
            "origin_created": "2017-01-01 15:35:00",
            "last_export": "2017-01-01 16:35:00",
            "data_load_start_time": null,
            "data_load_end_time": null,
            "schedules": []
        }
    ],
    "selection_settings": {
        "limit": 20,
        "offset": null,
        "order_by": "id",
        "order_dir": "ASC"
    }
}

On this page