Skip to content

Using the REST API

Creating an API token

Calling the REST API (opens in a new tab) requires an API token. The token is a random string of 32 characters that is transmitted as a bearer token in the Authorization header. (A JSON Web Token is not used.) To get a personal token, please create a new user with the role "API" under Systemdaten → Benutzer (opens in a new tab) (system data → users):

Creating an API user

The new user receives an invitation by email. As soon as the account has been activated via the link in this email, the token is generated. You will then find it in the user's details in the field API-Token. An API user cannot log in to the administration area.

Now use this token in the Authorization header to make an API call. Alternatively, you can pass the token as the parameter api_token.

Authorization: Bearer 1f319b0ec6aa2975e1a1d5464637949c

Methods and objects

Our REST API is extended with further methods and objects as required. The following objects are currently available.

ObjectURIMethods
Recipient/subscriptionRead, subscribe, change (status or personalisations), unsubscribe and delete recipients
List/groupRetrieve and create lists
Personalisation/personalizationCreate, retrieve and change personalisations
Blacklist/blacklistRetrieve, add and delete entries
Newsletter/newsletterRetrieve and create newsletters (optionally with a send job)

You will find a detailed description of all methods and parameters in the documentation on Swaggerhub (opens in a new tab). You can also try out the API directly there. To do so, use the "Authorize" function at the top right and then "Try it out" for the method you want.

Swaggerhub documentation

Example

A simple example of retrieving all lists could look like this:

$authorization = array('Authorization: Bearer 1f319b0ec6aa2975e1a1d5464637949c');
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.newstroll.de/group');
curl_setopt($curl, CURLOPT_HTTPHEADER, $authorization);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
print_r(json_decode($response, true));

The result then looks like this:

Array
(
    [0] => Array
        (
            [id] => 74415
            [titel] => newstroll.de
            [name] => Customers
            [publicgroup] => N
            [signonmail] => Y
            [commitment] => Y
            [signoffmail] => Y
            [signoffblist] => Y
            [commitsignon] => Y
            [commitsignoff] => Y
        )
)

Tools

We recommend Swagger.io (opens in a new tab) or Postman (opens in a new tab) as development tools.