Prepr Documentation

Prepr Documentation

Welcome to the Prepr Documentation. You'll find comprehensive guides and documentation to help you start working with Prepr as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Syncing segments

1. Getting the segments to sync

With a GET requests to /segments endpoint we get back a list of the segments the app is allowed to sync.

{
    "items": [
        {
            "id": "d4009fd91ed-4a3b-a252-985c82e1c",
            "created_on": "2018-03-28T07:51:08+00:00",
            "changed_on": null,
            "label": "Segment",
            "name": "Hiphop favorites",
            "mailchimp": false,
            "facebook_ads": false,
            "filters": {
                "age": {
                    "minimal": "53"
                },
                "tags": {
                    "has": [
                        "Hiphop/R&B"
                    ]
                }
            }
        },
        {
            "id": "eb1399-43e6-4024-9c8b-0d6c62caeb",
            "created_on": "2018-06-01T08:53:18+00:00",
            "changed_on": null,
            "label": "Segment",
            "name": "Weekend visitors 2018",
            "mailchimp": false,
            "facebook_ads": false,
            "filters": {
                "tags": {
                    "has": [
                        "weekender 2018"
                    ]
                }
            }
        }
		],
    "total": 2,
    "after": "YWZ0ZXJfMjU=",
    "before": "YmVmb3JlXzA=",
    "skip": 0,
    "limit": 25
}

2. Getting the Persons from a Segment.

For each segment received in the first call we do a new request to fetch the list of persons active in the segment /segments/{id}/persons.

Use pagination (How to use fields) to fetch all persons. The endpoint is limited to 500 results per request.

{
    "items": [
        {
            "id": "8985bfc-c482d-bff2-aaefdc3dc5f3",
            "firstname": "Barack",
            "lastname": "Obama",
            "custom": null,
            "date_of_birth": null,
            "gender": null,
            "email": null,
            "phone": null,
            "address": null,
            "tag": null,
            "lives_in": null,
            "terms": null,
            "pld": "https://frontoffice.paylogic.nl/?event_id=120858&point_of_sale_id=000000#pld=xxxxxxxxxxxxx"
        },
        {
            "id": "acf66f3-a48f-47e6-9055e578aa9",
            "firstname": "Donald",
            "lastname": "Trump",
            "custom": null,
            "date_of_birth": null,
            "gender": null,
            "email": null,
            "phone": null,
            "address": null,
            "tag": null,
            "lives_in": null,
            "terms": null,
            "pld": "https://frontoffice.paylogic.nl/?event_id=120858&point_of_sale_id=00000#pld=xxxxxxxx"
        }
 		],
    "total": 7,
    "after": "YWZ0ZXJfMTAwMA==",
    "before": "YmVmb3JlXzA=",
    "skip": 0,
    "limit": 25
}

3. Unsubscribing a Person from a Segment

To unsubscribe a Person from a segment use the DELETE request /segments/{id}/persons/{person_id}

To unsubscribe the segment has to have a delete term setting.