MailBeez.io API: Easy and progressive to implement

Introduction

When designing the MailBeez.io API, we took experience from the implementation of numerous APIs into account: Many API providers keep things easy for themselves and only provide endpoints for data transfer - the developer then has to implement the logic to control the sequence, time and result of calling these endpoints, which leads to significantly increased complexity.

Concept

Lean connector development

The MailBeez API was designed according to the following principles to make the development of the connectors as simple and lightweight as possible

  • No complex logging of synchronisation processes in the connector
  • Easy to implement webhook calls
  • Automation without cron jobs - MailBeez.io controls the synchronisation

Since the implementation of MailBeez connectors should be as simple as possible, MailBeez.io takes control of the complex synchronisation processes. The developer only has to develop functions to provide data in a well defined format.

So in short endpoints must be implemented for each resource (e.g. "customers", "orders"), to provide this data on request via a web hook.

Example: Transfer of customer data within the web hook


// load API Client
include('MBApiClient.php');

// you will receive these connection data from MailBeez.io
$host = 'http://myMailBeezUrl';
$user = 'myApiUser';
$pass = 'myApiPassword';

$mbApi = new MBApiClient($host, $user, $pass);

$dataArray = array(); // create array

// collect customer data from store database
$customers = getAllMyCustomers(); // here you retrieve all customer data

// loop through the result and add to $dataArray array
foreach ($customers as $customer) {
     $dataArray[] = array(
         "cID" => $customer['id'],
         "contact" => array(
             "email" => $customer['email_address'],
         )
     );
}

// pass the array with customers data to apiClient
$result = $mbApi->createCustomers($dataArray);

// done

The simplified code example shows how a new instance of the MailBeez API Client MBApiClient() is assigned to the variable $mbApi. Then the customer data is collected and finally with the call $mbApi->createCustomers($dataArray) transfered. The MailBeez.io system controls the call of this endpoint. In the actual implementation, parameters have to be supported in order to limit the amount of results for the section-by-section transfer (e.g. transfer customers from 200 to 300).

Progressive: just start and then expand

To start with MailBeez.io, only a few endpoints need to be implemented with few mandatory details (e.g. "Customers" -> Email address -> Newsletters can be sent). Other API-endpoints can be implemented progressively. A connection can thus be created and tested in a short time.

documentation

We highly advise to read the complete API to get an overview of the relationships.

The friendly MailBeez.io support is of course happy to help with qualified questions.


Request Quote

Top