Subscribers API (deprecated)


Deprecated

This API is now deprecated. We introduced the notion of List to regroup your subscribers and allow you to send different newsletters to different lists of subscribers. We recommend you to use the new Lists API to handle subscribers management, giving the ID of the list you want to modify as a parameter.


Token

To get a token, see the new API

Subscribers list

Counters

The end-point to list subscribers is paginated. So you need to get the total number of subscribers first :

GET https://services.ownpage.fr/v1/newsletters/subscribers/count
HEADER X-Ownpage-Client-Token

Return example in JSON format :

{
    "subscribed" : 12034,
    "unsubscribed" : 83,
    "cause": {
        "HARD_BOUNCE": 30,
        "PUBLISHER": 1,
        "READER": 52
    }
}

List with pagination

To get subscribers :

GET https://services.ownpage.fr/v1/newsletters/subscribers?status=STATUS&offset=OFFSET&count=COUNT&search=EMAIL
HEADER X-Ownpage-Client-Token

With the parameters :

Example, to get list in JSON :

curl -H "X-Ownpage-Client-Token:TOKEN" https://services.ownpage.fr/v1/newsletters/subscribers

Response example :

[
    { "email" : "email1@domaine.fr", "guid": "utilisateur1", "subscribed" : true, "subscribed_at": "2016-..." },
    { "email" : "email2@domaine.fr", "guid": "utilisateur2", "subscribed" : true, "subscribed_at": "2016-..." },
    ...
]

Subscription / Unsubscription

To subscribe or unsubscribe users to your personalized newsletter :

POST https://services.ownpage.fr/v1/newsletters/subscribers
HEADER X-Ownpage-Client-Token

Example of request content (file request-input.json) :

Request example :

curl -X POST -H "X-Ownpage-Client-Token:TOKEN" -H "Content-Type:application/json" -d @request-input.json https://services.ownpage.fr/v1/newsletters/subscribers

Request content example (file request-input.json) :

{
    "email" : "jean-l@ownpage.fr",
    "guid" : "123456",
    "subscribed" : "true",
    "pseudo" : "jean-l",
    "first_name" : "Jean",
    "last_name" : "Lutilisateur",
    "location" : "75",
    "segment" : "segment1"
}

Response in case of error (L1 is the number of line) :

{
    "status": "INVALID_REQUEST",
    "message": "1 error(s): L1: email is missing or invalid"
}

Subscription / Unsubscription by batch

You can handle subscriptions by batch with a maximum of 20 000 lines.

Request content example (file request-input.json) :

[
    { "email" : "jean-l@ownpage.fr", "guid" : "123456", "subscribed":true },
    { "email" : "claire-t@ownpage.fr", "guid" : "123457", "subscribed":false, "unsubscribed_cause":"READER" },
    ...
]