Skip to content

Using the REST API

Creating a JSON Web Token

Calling the REST API (opens in a new tab) requires an access token. We use a JSON Web Token (opens in a new tab), which is transmitted as a bearer token in the Authorization field. To get a personal token, please create a new user with API permissions:

Creating an API user

You will now find the token in the details of the newly created user:

Bearer token

Now use this token in the Authorization header to make an API call.

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 and unsubscribe recipients
List/groupRetrieve lists and change their settings
Personalisation/personalizationCreate and retrieve personalisations
Blacklist/blacklistRetrieve, add and delete entries
Newsletter/newsletterRetrieve and create newsletters

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
        )
)

Tools

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