NAV
shell php

Introduction (BETA)

Introduction (BETA) Welcome to the Infomaniak Newsletter API! You can use our API to access the Infomaniak Newsletter API endpoints, which can get information on various Campaign, Contact, and Mailinglist in our database.

We have language bindings in Shell, PHP.

For easy integration, you can use our wrapper for the PHP language on github, you can view code examples in the darker area to the right, and you can switch the programming language of the examples with the tabs in the top left section of this darker area.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
    -H 'Content-Type: application/json' \
    --user 'CLIENT_API:CLIENT_SECRET'
<?php
  require 'vendor/autoload.php';
  use \Infomaniak\ClientApiNewsletter\Client;

  // With php, you can instanciate the class like that
  $client = new Infomaniak\ClientApiNewsletter\Client(CLIENT_API, CLIENT_SECRET);
?>

Make sure to replace CLIENT_API:CLIENT_SECRET with your API keys.

Infomaniak uses API keys to allow access to the API. You can register a new Infomaniak API key at our developer portal.

The API key needs to have the scope newsletter.

Infomaniak expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Basic CLIENT_API:CLIENT_SECRET

Campaign

CreateCampaign

curl --user 'CLIENT_API:CLIENT_SECRET'
    -H 'Content-Type: application/json'
    -X POST
    --data '{
        "subject":"test",
        "email_from_name":"testemail",
        "lang":"fr",
        "email_from_addr":"testemail",
        "content":"<span>My content<\/span>",
        "mailinglistIds": [1,2,3]
    }'
    "https://newsletter.infomaniak.com/api/v1/public/campaign"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);
    $response = $client->post(Client::CAMPAIGN, [
        'params' => [
            'subject' => 'test',
            'email_from_name' => 'testemail',
            'lang' => 'fr',
            'email_from_addr' => 'testemail',
            'content' => '<span>My content</span>',
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id": 1337,
    "subject": "test",
    "status": 2,
    "status_label": "Draft",
    "started_at": null
}

Create a new campaign

HTTP Request

POST /campaign

Query Parameters

Name Type Description
id Number Campaign unique ID
subject String Subject campaign
email_from_name String Name for address from
lang String Lang campaign
email_from_addr String Email for address from
content String Content HTML
mailinglistIds Array(Number)
Number
List of mailinglist IDs

DeleteCampaign

curl --user 'CLIENT_API:CLIENT_SECRET'
    -H 'Content-Type: application/json'
    -X DELETE
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->delete(Client::CAMPAIGN, ['id' => {id}]);

    $response->success() && var_dump($response->datas());

?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data": "Campaign deleted"
}

Delete a campaign

HTTP Request

DELETE /campaign/:id

Query Parameters

Name Type Description
id Number Campaign unique ID

GetCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::CAMPAIGN, ['id' => {id}]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id": 1337,
    "subject": "My first subject",
    "status": 2,
    "status_label": "Draft",
    "started_at": null,
    "email_from_name": "test",
    "lang": "en_GB",
    "email_from_addr": "test@mydomain.com",
    "content": "Content of my campaign",
    "mailinglists": []
}

Retrieve campaign information

HTTP Request

GET /campaign/:id

Query Parameters

Name Type Description
id Number Campaign unique ID

GetCampaigns

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/campaign"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::CAMPAIGN), [
        'params'    => ['page' => 1]
    ];

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "subject": "My first subject",
    "status": 2,
    "status_label": "Draft",
    "started_at": null
  },
  {
    "id": 2,
    "subject": "My second subject",
    "status": 2,
    "status_label": "Draft",
    "started_at": null
  }
]

Retrieve all campaigns

HTTP Request

GET /campaign

Query Parameters

Name Type Description
page Number optional Current page

GetScheduleCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}/schedule"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::CAMPAIGN, [
        'id'        => {id},
        'action'    => Action::SCHEDULE
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "scheduled_at":
    {
        "date":"2016-12-25 13:37:00",
        "timezone_type":3,
        "timezone":"Europe\/Zurich"
    }
}

Retrieve the scheduled time for a campaign

HTTP Request

GET /campaign/:id/schedule

Query Parameters

Name Type Description
id Number Campaign unique ID

ScheduleCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    --data '{
        "scheduled_at":"2016-12-25 13:37:00"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}/schedule"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::CAMPAIGN, [
        'id'        => {id},
        'action'    => Action::SCHEDULE,
        'params'    => [
            'scheduled_at' => '2016-12-25 13:37:00'
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id":80,
    "scheduled_at":
    {
        "date":"2016-12-25 13:37:00",
        "timezone_type":3,
        "timezone":"Europe\/Zurich"
    }
}

Schedule a campaign

HTTP Request

POST /campaign/:id/schedule

Query Parameters

Name Type Description
id Number Campaign unique ID
scheduled_at Datetime Datetime for schedule

SendCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}/send"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::CAMPAIGN, [
        'id'        => {id},
        'action'    => Action::SEND
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data":
    {
        "id": 80,
        "scheduled_at":
        {
            "date":"2016-12-25 13:37:00",
            "timezone_type":3,
            "timezone":"Europe\/Zurich"
        }
    }
}

Send a campaign

HTTP Request

POST /campaign/:id/send

Query Parameters

Name Type Description
id Number Campaign unique ID

TestCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    --data '{
        "email":"myemail@mydomain.com"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}/test"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::CAMPAIGN, [
        'id'        => {id},
        'action'    => Action::TEST,
        'params'    => [
            'email' => 'myemail@mydomain.com'
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data": "Test sent to myemail@mydomain.com"
}

Send a test email

HTTP Request

POST /campaign/:id/test

Query Parameters

Name Type Description
id Number Campaign unique ID
email String Email to send the test

UnscheduleCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}/unschedule"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::CAMPAIGN, [
        'id'        => {id},
        'action'    => Action::UNSCHEDULE,
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data":
    {
        "id": 1337,
        "scheduled_at":null
    }
}

Unschedule a campaign

HTTP Request

POST /campaign/:id/unschedule

Query Parameters

Name Type Description
id Number Campaign unique ID

UpdateCampaign

curl --user 'CLIENT_API:CLIENT_SECRET' -X PUT
    -H 'Content-Type: application/json'
    --data '{
        "content":"<span>My content updated<\/span>"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->put(Client::CAMPAIGN, [
        'id' => {id},
        'params' => [
            'content' => '<span>My content updated</span>',
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id": 1337,
    "subject": "My subject",
    "status": 2,
    "status_label": "Draft",
    "started_at": null
}

Update a campaign

HTTP Request

PUT /campaign/:id

Query Parameters

Name Type Description
id Number Campaign unique ID
subject String optional Subject campaign
email_from_name String optional Name for address from
lang String optional Lang campaign
email_from_addr String optional Email for address from
content String optional Content HTML
mailinglistIds String optional List of mailinglist IDs

GetCampaignStatistics

Retrieve campaign statistics

HTTP Request

GET /campaign/:id/statistics

Query Parameters

Name Type Description
id Number Campaign unique ID
curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/campaign/{id}/statistics"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::CAMPAIGN, [
        'id'        => {id},
        'action'    => Action::STATISTICS,        
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "statistics" : {
        "total" : 150,
        "sended" : 150,
        "opened" : 100,
        "opened_unique": 80,
        "clicked" : 50,
        "delivered" : 150,
        "complainted" : 1,
        "hard_bounced" : 1,
        "soft_bounced" : 2,
        "unsubscribed" : 5,
        "cancel" : 0
    },
    "links": [
        {
            "url": "http://...",
            "unique_click": 7,
            "click": 7
        },
        {
            "url": "http://...",
            "unique_click": 25,
            "click": 55
        }
    ],
    "devices" : {
        "mobile" : 25,
        "tablet" : 50,
        "desktop": 25
    }
  },
]

Contact

DeleteContact

curl --user 'CLIENT_API:CLIENT_SECRET' -X DELETE
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/contact/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $response = $client = new Client(CLIENT_API, CLIENT_SECRET);

    $client->delete(Client::CONTACT, ['id' => {id}]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data":"Contact deleted"
}

Delete contact

HTTP Request

DELETE /contact/:id

Query Parameters

Name Type Description
id Number-String Contact unique ID or Contact email address

GetContact

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/contact/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::CONTACT, [id : {id}]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
  "id": 1337,
  "email": "test@mydomain.com",
  "created_at": "2016-12-25 13:37:00",
  "updated_at": "2016-12-25 13:37:00",
  "metas": [
    {"name":"firstname","slug":"firstname","value":"test"}
  ],
  "mailinglists": [
    {"id":1337,"name":"My first mailinglist","subscribed_at":"2016-12-26 13:37:00"}
  ]
}

Retrieve contact information

HTTP Request

GET /contact/:id

Query Parameters

Name Type Description
id Number - String Contact unique ID or Contact email address

UpdateContact

curl --user 'CLIENT_API:CLIENT_SECRET' -X PUT
    -H 'Content-Type: application/json'
    --data '{
        "firstname":"test first"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/contact/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->put(Client::CONTACT, [
         'id' => {id},
         'params' => [
             'firstname' => 'test first'
         ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
  "id": 1337,
  "email": "test@mydomain.com",
  "created_at": "2016-12-25 13:37:00",
  "updated_at": "2016-12-25 13:37:00",
  "metas": [
    {"name":"firstname","slug":"firstname","value":"test first"}
  ],
  "mailinglists": [
    {"id":1337,"name":"My first mailinglist","subscribed_at":"2016-12-26 13:37:00", "status":1,"status_label":"Enrolled"}
  ]
}

Update contact information

HTTP Request

PUT /contact/:id

Query Parameters

Name Type Description
id Number - String Contact unique ID or Contact email address
email String optional Email contact
firstname String optional Firstname contact
lastname String optional Lastname contact

Mailinglist

CreateMailinglist

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    --data '{
        "name":"My first mailinglist"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::MAILINGLIST, [
        'params' => [
            'name' => 'My first mailinglist',
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id": 1337,
    "name": "My first mailinglist",
    "status": 1,
    "status_label": "online",
    "created_at": "2016-12-25 13:37:00",
    "updated_at": "2016-12-25 13:37:00"
}

Create a new mailinglist

HTTP Request

POST /mailinglist

Query Parameters

Name Type Description
name String Mailinglist name

updateMailinglist

curl --user 'CLIENT_API:CLIENT_SECRET' -X PUT
    -H 'Content-Type: application/json'
    --data '{
        "name":"My first mailinglist"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->put(Client::MAILINGLIST, [
        'id' => {id},
        'params' => [
            'name' => 'My first mailinglist',
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id": 1337,
    "name": "My first mailinglist",
    "status": 1,
    "status_label": "online",
    "created_at": "2016-12-25 13:37:00",
    "updated_at": "2016-12-25 13:37:00"
}

Update a mailinglist

HTTP Request

PUT /mailinglist/:id

Query Parameters

Name Type Description
id Number Mailinglist id
name String Mailinglist name

DeleteMailinglist

curl --user 'CLIENT_API:CLIENT_SECRET' -X DELETE
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->delete(Client::MAILINGLIST, ['id' => {id}]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data": "Mailinglist deleted"
}

Delete a mailinglist

HTTP Request

DELETE /mailinglist/:id

Query Parameters

Name Type Description
id Number Mailinglist unique ID

GetContacts

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist/{id}/contact"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::MAILINGLIST, [
        'id' => {id},
        'action' => Action::LISTCONTACT,
        'params' => ['page' => 2, 'perPage' => 20]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

[
    {
        "id": 1337,
        "email": "test1@mydomain.com",
        "status": 1,
        "status_label": "Enrolled"
    },
    {
        "id": 1338,
        "email": "test2@mydomain.com",
        "status": 1,
        "status_label": "Enrolled"
    }
]

Retrieve contacts for the mailinglist

HTTP Request

GET /mailinglist/:id/contact

Query Parameters

Name Type Description
id Number Mailinglist unique ID
page Number optional Current page
perPage Number optional

GetMailinglist

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::MAILINGLIST, ['id' => {id}])


?>

The above command returns JSON structured like this:

{
  "id": 1337,
  "name": "My first mailinglist",
  "status": 1,
  "status_label": "online",
  "created_at": "2016-12-25 13:37:00",
  "updated_at": "2016-12-25 13:37:00",
  "subscribed_count": 50,
  "unsubscribed_count": 5,
  "pended_count": 3,
  "processing_count": 2
}

Retrieve mailinglist information

HTTP Request

GET /mailinglist/:id

Query Parameters

Name Type Description
id Number Mailinglist unique ID

GetMailinglists

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::MAILINGLIST, [
        'params' => ['page' => 1, 'perPage' => 20]        
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

[
  {
      "id": 1337,
      "name": "My first mailinglist",
      "status": 1,
      "status_label": "online",
      "created_at": "2016-12-25 13:37:00",
      "updated_at": "2016-12-25 13:37:00"
  },
  {
      "id": 1338,
      "name": "My second mailinglist",
      "status": 1,
      "status_label": "online",
      "created_at": "2016-12-25 13:37:00",
      "updated_at": "2016-12-25 13:37:00"
  }
]

Retrieve all mailinglists

HTTP Request

GET /mailinglist

Query Parameters

Name Type Description
page Number optional Current page
perPage Number optional

ImportContact

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    --data '{
        "contacts": [
            {"email": "test1@mydomain.com"},
            {"email": "test2@mydomain.com"},
            {"email": "test3@mydomain.com"}
        ]
    }'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist/{id}/importcontact"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::MAILINGLIST, [
        'id'        => {id},
        'action'    => Action::IMPORTCONTACT,
        'params'    => [
            'contacts' => [
                ['email' => 'test1@mydomain.com'],
                ['email' => 'test2@mydomain.com'],
                ['email' => 'test3@mydomain.com'],
            ]
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data":
    {
        "task_id": 1337
    }
}

Import contact in a mailinglist

HTTP Request

POST /mailinglist/:id/importcontact

Query Parameters

Name Type Description
id Number Mailinglist unique ID
contacts Object[] Email contacts with metas
update_metas Boolean If you wish to put updated the metas on a existed contact

ManageContact

curl --user 'CLIENT_API:CLIENT_SECRET' -X POST
    -H 'Content-Type: application/json'
    --data '{
        "email": "test1@mydomain.com",
        "status": "delete"
    }'
    "https://newsletter.infomaniak.com/api/v1/public/mailinglist/{id}/managecontact"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;
    use \Infomaniak\ClientApiNewsletter\Action;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->post(Client::MAILINGLIST, [
        'id' => 1337,
        'action' => Action::MANAGECONTACT,
        'params' => [
            'email' => 'test1@mydomain.com',
            'status' => Action::DELETE
        ]
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "id": 1337,
    "email": "test1@mydomain.com",
    "created_at": "2016-12-25 13:37:00",
    "created_at": "2016-12-25 13:37:00",
    "metas": [],
    "mailinglists": []
}

Unsubscribe or delete a contact for a mailinglist

HTTP Request

POST /mailinglist/:id/managecontact

Query Parameters

Name Type Description
id Number Mailinglist unique ID
email String Email contact
status String Status contact (unsub/delete)

Task

GetTask

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/task/{id}"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::TASK, [
        'id' => {id}
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data":
    {
        "count": 3,
        "current": 1
    }
}

Retrieve import information

HTTP Request

GET /task/:id

Query Parameters

Name Type Description
id Number Task unique ID

Credits

GetCredit

curl --user 'CLIENT_API:CLIENT_SECRET' -X GET
    -H 'Content-Type: application/json'
    "https://newsletter.infomaniak.com/api/v1/public/credit"
<?php
    require 'vendor/autoload.php';
    use \Infomaniak\ClientApiNewsletter\Client;

    $client = new Client(CLIENT_API, CLIENT_SECRET);

    $response = $client->get(Client::CREDIT, [
        'id' => {id}
    ]);

    $response->success() && var_dump($response->datas());
?>

The above command returns JSON structured like this:

{
    "result": "success",
    "data":
    {
        "credit": 10
    }
}

Retrieve import information

HTTP Request

GET /credit

Query Parameters

Name Type Description
credit Number Number of credits