API v2 Documentation [BETA]

Users

Get SubAccounts

Get a list of SubAccounts.

GET

/Users/SubAccounts/

Parameters:
  • Integer
    limit
    100 is set as a default and 1000 is maximum



    Number of records you want to fetch.
  • Integer
    offset



    Starting point.
Response:
  • On success:
    HTTP code 200



    Json object with triggers.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl GET 'https://api.mailmailmail.net/v2.0/Users/SubAccounts?limit=10&offset=0' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' 
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$limit = 10;
$offset = 0;

$result = $parser->GetSubAccounts($limit, $offset);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';

ApiParser parser = new ApiParser(username, token);

int limit = 10;
int offset = 0;

string result = parser.GetSubAccounts(limit, offset);

Sample Response


{
 "status": true,
 "code": 200,
 "data": [{
  "groupid": "249",
  "username": "sub_account5988",
  "status": "1",
  "fullname": "sub_account5988",
  "ownerEmail": "sub_account@email.com",
  "phone": "",
  "usertimezone": "Europe/Skopje",
  "createdate": "1616760620",
  "lastloggedin": "1616744533"
 }, {
  "groupid": "250",
  "username": "sub_account_filip",
  "status": "1",
  "fullname": "Filip",
  "ownerEmail": "example@email.com",
  "phone": "",
  "usertimezone": "Europe/Skopje",
  "createdate": "1616760620",
  "lastloggedin": "1616744533"
 }]
}

{
   "status": false,
   "code": 401,
   "message": "You have attempted to execute a API call with incorrect credentials! Access denied!"
}

Create SubAccount

Create sub account from your admin account.

POST

/Users/SubAccounts/

Parameters:
  • String
    accountName
    Required



    Set username for your new sub account.
  • String
    accountPassword
    Required



    Set password for your new sub account.
  • String
    ownerEmail
    Required



    Set owner email for your new sub account.
  • Array
    allowedDomains
    Required



    Set which domains will be able to use this sub account.
Response:
  • On success:
    HTTP code 201



    Json with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl POST 'https://api.mailmailmail.net/v2.0/Users/SubAccounts' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '{"accountName":"test-account_4","accountPassword":"password","ownerEmail":"test@localhost.com","allowedDomains":["@localhost.com","@some_dk.com"]}'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "test-account_4";
$accountPassword = "password";
$ownerEmail = "test@localhost.com";
$allowedDomains = array("@localhost.com, some_dk.com");

$result = $parser->CreateSubAccount($accountName, $accountPassword, $ownerEmail, $allowedDomains);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 
ApiParser parser = new ApiParser(username, token);

string accountName = "test-account_4";
string accountPassword = "password";
string ownerEmail = "test@example.com";
string[] allowedDomains = {"@example.com"};

string result = parser.CreateSubAccount(accountName, accountPassword, ownerEmail, allowedDomains);

Sample Response


{
   "status":true,
   "code":201
   "data":{
      "message":"New sub account created successfully."
    }
}

{
 "status":false,
 "code":400,
 "message":"Parameter ownerEmail is empty."
}

Set Status SubAccount

Activate/Deactivate SubAccount.

PUT

/Users/SubAccounts/

Parameters:
  • String
    accountName
    Required



    Username for your new sub account.
  • Boolean
    status



    New status for sub account.
Response:
  • On success:
    HTTP code 200



    JSON object with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl PUT 'https://api.mailmailmail.net/v2.0/Users/SubAccounts' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '{"accountName":"sub_account3265","status":false}'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "sub_account3265";
$status = false; // Active = true; Disabled = false

$result = $parser->SetSubAccountStatus($accountName, $status);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 
ApiParser parser = new ApiParser(username, token);

string accountName = "sub_account3265";
bool status = false; // Active = true; Disabled = false

string result = parser.SetSubAccountStatus(triggerid, status);

Sample Response


{
   "status":true,
   "code":200,
   "data":{
      "message":"Sub account has been updated"
   }
}

{
   "status":false,
   "code":400,
   "message":"Parameter accountName is empty"
}

Get Inherit lists

Get a list of inherit lists.

GET

/Users/InheritLists/

Parameters:
  • String
    accountName
    Required



    Sub account name.
  • Integer
    limit
    100 is set as a default and 1000 is maximum



    Number of records you want to fetch.
  • Integer
    offset



    Starting point.
Response:
  • On success:
    HTTP code 200



    Json object with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl GET 'https://api.mailmailmail.net/v2.0/Users/InheritLists?accountName=sub_account_name&limit=10&offset=0' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' 
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "sub_account_name";
$limit = 10;
$offset = 0;

$result = $parser->GetInheritedLists($accountName, $limit, $offset);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 
ApiParser parser = new ApiParser(username, token);

string accountName = 'sub_account_name';
int limit = 10;
int offset = 0;

string result = parser.GetInheritedLists(accountName, limit, offset);

Sample Response


{
  "status": true,
  "code": 200,
  "data": [{
    "listid": "7608",
    "listName": "Test_Case_List_Denmark_11815114",
    "descriptiveName": "Description 1",
    "ownername": "Denis Green",
    "owneremail": "some@ownerDK.com",
    "replytoemail": "some@ownerDK.com",
    "companyname": "",
    "companyemail": "",
    "companyaddress": "",
    "companyphone": "",
    "subscribecount": "0",
    "unsubscribecount": "0",
    "bouncecount": "0",
    "deleted": "0",
    "smssubscribecount": "0",
    "sms_prefix": ""
  }, {
    "listid": "7609",
    "listName": "Test_Case_List_Denmark_81059802",
    "descriptiveName": "Description 2",
    "ownername": "Denis Bank",
    "owneremail": "some2@ownerDK.com",
    "replytoemail": "some2@ownerDK.com,
    "companyname": "",
    "companyemail": "",
    "companyaddress": "",
    "companyphone": "",
    "subscribecount": "0",
    "unsubscribecount": "0",
    "bouncecount": "0",
    "deleted": "0",
    "smssubscribecount": "0",
    "sms_prefix": ""
  }]
}

{
   "status": false,
   "code": 401,
   "message": "Specified account is not your sub account."
}

InheritListsToSubAccount

Inherit lists from your admin account to sub account.

PUT

/Users/InheritLists/

Parameters:
  • String
    accountName
    Required



    Set sub account name that you want to inherit lists.
  • Array
    inheritLists



    Set lists which need to be inherited.
Response:
  • On success:
    HTTP code 200



    Json with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl PUT 'https://api.mailmailmail.net/v2.0/Users/InheritLists' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '{"accountName":"InheritLists_Test","inheritLists":[234,23452,3123,32]}'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";


$parser = new ApiParser($settings);

$accountName = "InheritLists_Test";
$inheritLists = array(1,2);

$result = $parser->InheritListsToSubAccount($accountName, $inheritLists);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 

ApiParser parser = new ApiParser(username, token);

string accountName = "InheritLists_Test";
int[] inheritLists = new int[] {1, 2};

string result = parser.InheritListsToSubAccount(accountName, inheritLists);

Sample Response


{

   "status":true,
   "code":200
   "data":{
      "message":"Inherit successful."
    }
}

{
 "status":false,
 "code":401,
 "message":"Specified account is not your sub account"
}

Delete Inherit Lists

Delete Inherit Lists for specific sub account

DELETE

/Users/InheritLists/

Parameters:
  • String
    accountName
    Required



    Sub account name.
  • Integer
    listid
    Required



    Inherit listid ID that will be deleted.
Response:
  • On success:
    HTTP code 200



    JSON object with data fields.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl DELETE 'https://api.mailmailmail.net/v2.0/Users/InheritLists/' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '[{"accountName":"InheritLists_Test"},{"listid":12}]'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "InheritLists_Test";
$listid = 12;

$result = $parser->RemoveInheritedList($accountName, $listid);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 
ApiParser parser = new ApiParser(username, token);

string accountName = 'InheritLists_Test';
int listid = 12;

string result = parser.RemoveInheritedList(accountName, listid);

Sample Response


{
   "status":true,
   "code":200,
   "data":{
      "message":"Inherited list has been deleted."
    }
}

{
   "status":false,
   "code":403,
   "message":"This user is not owner of the list"
}

Get Inherit Segments

Get a list of Inherit Segments.

GET

/Users/InheritSegments/

Parameters:
  • String
    accountName
    Required



    Sub account name.
  • Integer
    limit
    100 is set as a default and 1000 is maximum



    Number of records you want to fetch.
  • Integer
    offset



    Starting point.
Response:
  • On success:
    HTTP code 200



    Json with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl GET 'https://api.mailmailmail.net/v2.0/Users/InheritSegments?accountName=sub_account_name&limit=10&offset=0' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' 
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "sub_account_name";
$limit = 10;
$offset = 0;

$result = $parser->GetInheritedSegments($accountName, $limit, $offset);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 
ApiParser parser = new ApiParser(username, token);

string accountName = 'sub_account_name';
int limit = 1;
int offset = 0;

string result = parser.GetInheritedSegments(accountName, limit, offset);

Sample Response


{
 "status":true,
 "code":200,
 "data":[
  {
    "segmentid":1,
    "segmentname":"Test GetStatidsBySegment",
    "createdate":1580307521,
    "updatedate":1580307521,
    "usedlists":[
      9
    ],
    "otmrule":0,
    "wtrrule":0,
    "searchinfo":{
      "Lists":[
        [
          9
        ]
      ],
      "Rules":[
        [
          {
            "type":"group",
            "rules":[
              {
                "type":"rule",
                "connector":"and",
                "rules":{
                  "ruleName":"email",
                  "ruleOperator":"like",
                  "ruleValues":[
                    "toni"
                  ]
                }
              }
            ],
            "connector":"and"
          }
        ]
      ],
      "Operators":null
    }
  }
 ]
}

{
   "status": false,
   "code": 401,
   "message": "You have attempted to execute a API call with incorrect credentials! Access denied!"
}

Inherit Segments

Inherit segments to sub account.

PUT

/Users/InheritSegments/

Parameters:
  • String
    accountName
    Required



    Set sub account name that you want to inherit segments.
  • Array
    inheritSegments



    Set segments which need to be inherited.
Response:
  • On success:
    HTTP code 200



    Json array with message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl PUT 'https://api.mailmailmail.net/v2.0/Users/InheritSegments' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '{"accountName":"InheritSegments_Test","inheritSegments":[23,442,1234]}'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";


$parser = new ApiParser($settings);

$accountName = "InheritSegments_Test";
$inheritSegments = array(1, 2);

$result = $parser->InheritSegmentsToSubAccount($accountName, $inheritSegments);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 

ApiParser parser = new ApiParser(username, token);

string accountName = "InheritSegments_Test";
int[] inheritSegments = new int[] {1, 2};

string result = parser.inheritSegments(accountName, inheritSegments);

Sample Response


{

   "status":true,
   "code":201
   "data":{
      "message":"Inherit successful."
    }
}

{
 "status":false,
 "code":400,
 "message":"Parameter accountName is empty."
}

Delete Inherit Segments

Delete Inherited Segment from Specific account

DELETE

/Users/InheritSegments/

Parameters:
  • String
    accountName
    Required



    Sub account name.
  • Integer
    segmentid
    Required



    Inherit segment ID that will be deleted.
Response:
  • On success:
    HTTP code 200



    JSON with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl DELETE 'https://api.mailmailmail.net/v2.0/Users/InheritSegments/' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '[{"accountName":"InheritSegments_Test"},{"segmentid":12}]'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "InheritSegments_Test";
$segmentid = 12;

$result = $parser->RemoveInheritedSegment($accountName, $segmentid);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';

ApiParser parser = new ApiParser(username, token);

string accountName = 'InheritSegments_Test';
int segmentid = 12;

string result = parser.RemoveInheritedSegment(accountName, segmentid);

Sample Response


{
   "status":true,
   "code":200,
   "data":{
      "message":"Inherited segment has been deleted."
    }
}

{
   "status":false,
   "code":403,
   "message":"Only inherit segments can be deleted."
}

Get Inherit Newsletters

Get a list of Inherited Newsletters.

GET

/Users/InheritNewsletters/

Parameters:
  • String
    accountName
    Required



    Sub account name.
  • Integer
    limit
    100 is set as a default and 1000 is maximum



    Number of records you want to fetch.
  • Integer
    offset



    Starting point.
Response:
  • On success:
    HTTP code 200



    Json with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl GET 'https://api.mailmailmail.net/v2.0/Users/InheritNewsletters?accountName=sub_account_name&limit=10&offset=0' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' 
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "sub_account_name";
$limit = 10;
$offset = 0;

$result = $parser->GetInheritedNewsletters($accountName, $limit, $offset);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';

ApiParser parser = new ApiParser(username, token);

string accountName = 'sub_account_name';
int limit = 10;
int offset = 0;

string result = parser.GetInheritedNewsletters(accountName, limit, offset);

Sample Response


{
   "status":true,
   "code":200,
   "data":[
      {
         "newsletterid":"1",
         "name":"Newsletter name",
         "subject":"Newsletter subject",
         "createdate":"1613119186",
         "active":"1",
         "updatedate":"1616410086",
         "selectedlists":[
            "6"
         ],
         "selectedsegments":[
            
         ],
         "url":"https://app.marketingplatform.com/display.php?N=1&T=933c3640325"
      },
      {
         "newsletterid":"2",
         "name":"Newsletter name 2",
         "subject":"Newsletter subjects 2",
         "createdate":"1613119194",
         "active":"1",
         "updatedate":"1613120415",
         "selectedlists":[
            "6"
         ],
         "selectedsegments":[
            
         ],
         "url":"https://app.marketingplatform.com/display.php?N=2&T=933c3640325"
      }
   ]
}

{
   "status": false,
   "code": 401,
   "message": "You have attempted to execute a API call with incorrect credentials! Access denied!"
}

Inherit Newsletter

Inherit newsletter to sub account.

PUT

/Users/InheritNewsletters/

Note: You can't inherit newsletter that contains dynamic content or relation fields.
Parameters:
  • String
    accountName
    Required



    Set sub account name that you want to inherit newsletter.
  • Integer
    newsletterid



    Newsletter ID that will be inherited.
  • String
    recipientsType



    Choose recipients type. Available options "list" and "segment".
  • Array
    recipeintsid



    Specify list or segment ids you want to be recipients with inherited newsletter.
Response:
  • On success:
    HTTP code 200



    Json with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl PUT 'https://api.mailmailmail.net/v2.0/Users/InheritNewsletters' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '{"accountName":"InheritNewsletter_Test","newsletterid":123,"recipientsType":"segment","recipeintsid":[23,55,23,5232]}'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";


$parser = new ApiParser($settings);

$accountName = "InheritNewsletter_Test";
$newsletterid = 123;
$recipientsType = "segment";
$recipeintsid = array(1, 2);

$result = $parser->InheritNewsletterToSubAccount($accountName, $newsletterid, $recipientsType, $recipeintsid);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 

ApiParser parser = new ApiParser(username, token);

string accountName = "InheritNewsletter_Test";
int newsletterid = 123;
string recipientsType = "segment";
int[] recipeintsid = new int[] {1, 2};

string result = parser.InheritNewsletterToSubAccount(accountName, newsletterid, recipientsType, recipeintsid);

Sample Response


{

   "status":true,
   "code":201
   "data":{
      "message":"Inherit successful."
    }
}

{
 "status":false,
 "code":401,
 "message":"Specified account is not your sub account"
}

Delete Inherit Newsletter

Delete Inherited Newsletter from Specific Sub Account

DELETE

/Users/InheritNewsletters/

Parameters:
  • String
    accountName
    Required



    Sub account name.
  • Integer
    newsletterid
    Required



    Inherit newsletter ID that will be deleted.
Response:
  • On success:
    HTTP code 200



    JSON object with success message.
  • On failure:
    HTTP code 4xx, 5xx



    Error message describing the reason for the failure.
curl DELETE 'https://api.mailmailmail.net/v2.0/Users/InheritNewsletters/' -H 'Apiusername: API_USERNAME' -H 'Apitoken: API_TOKEN' -H 'Content-Type: application/json' -d '[{"accountName":"InheritNewsletter_Test"},{"newsletterid":15}]'
require_once dirname(__FILE__) . "/ApiParser.class.php";

$settings['username'] = "API_USERNAME";
$settings['token'] = "API_TOKEN";

$parser = new ApiParser($settings);

$accountName = "InheritNewsletter_Test";
$newsletterid = 15;

$result = $parser->RemoveInheritedNewsletter($accountName, $newsletterid);

print_r($result);
using MarketingPlatform;

string username = 'API_USERNAME';
string token = 'API_TOKEN';
 
ApiParser parser = new ApiParser(username, token);

string accountName = "InheritNewsletter_Test";
int newsletterid = 15;

string result = parser.RemoveInheritedNewsletter(accountName, newsletterid);

Sample Response


{
   "status":true,
   "code":200,
   "data":{
      "message":"Inherited campaign has been deleted."
    }
}

{
   "status":false,
   "code":400,
   "message":"Missing required parameter."
}
version 2.0.6