AutomizyJs API Docs

Developers Page GitHub Downloads

Introduction

What is AutomizyJs API?

AutomizyJs API is a wide collection of JavaScript modules which allows easy and fast communication with the software Automizy through API.

Automatic authentication

Through AutomizyJs API you can log in to the software without any effort, the only thing you need to know is a user name and password. The API does all the hard work, you don't have to mess with token validation, although it gives the opportunity to do so if you really want.

Execute complex queries faster than ever.

By using the basic functions of AutomizyJs API you can get any data of a given module in the winkling of an eye, you only have to give some simple conditions.

Standardized return values

AutomizyJs API utilizes all features jQuery provides, every query returns a jqXHR object, this way you will be able to use the results in any context.

Token

These are special functions which can be used on tokens.
There is a refresh loop running in the background, checking every 30 seconds if the access token is expired or expires in the following 120 seconds. If the token is close to its expiration time, this loop will generate a new one. If it expires the user won't be able to access the server until he gets a new one.

refreshLoopStop

Use this function to stop the above described refresh loop.
//Stopping the loop - the user won't get a new token
$AA.token().refreshLoopStop();
                

refreshLoopStart

Use this function to start the above described refresh loop.
//Starting the loop 
$AA.token().refreshLoopStart();
                

refreshLoopRestart

Use this function to restart the above described refresh loop.
//Restarting the loop
$AA.token().refreshLoopRestart();
                

get

Use this function to get the acces token.
//Getting the acces token
$AA.token().get();
                
Returns: String

refresh

Use this function to refresh the access token.
//Refreshing the access token
$AA.tokens.refresh();
                

error

This function is called when an error occures during an API request. This can happen if you call a module or basic function with bad parameters.
Parameters:
func: The function you want to invoke when an error occures.
//Setting the error function
$AA.token().error(function(){
    alert('Error occured!');
});
                

success

This function is called when an API request is successful.
Parameters:
func: The function you want to invoke in case of success.
//Setting the success function
$AA.token().success(function(){
    alert('Success');
});
                

loginError

This function is called when the user tries to log in with invalid data. (For example logging in with empty password field.)
Please note that while the input is invalid, no data will be sent to the server.
Parameters:
func: The function you want to invoke when a login error occures.
//Setting the loginError function
$AA.token().loginError(function(){
    alert('Invalid input!');
});
                

loginAjaxError

This function is called when the user tries to log in with incorrect data.
In this case the server will reject the login request.
Parameters:
func: The function you want to invoke when the server rejects a login request.
//Setting the loginAjaxError function
$AA.token().loginAjaxError(function(){
    alert('Wrong user name or password!');
});
                

loginAjaxSuccess

This function is called when the login process is successful.
Parameters:
func: The function you want to invoke when the login process is successful.
//Setting the loginAjaxSuccess function
$AA.token().loginAjaxSuccess(function(){
    alert('Logged in successfully!');
});
                

refreshAjaxError

This function is called when the user's refresh token is invalid/expired.
Parameters:
func: The function you want to invoke.
//Setting the refreshAjaxError function
$AA.token().refreshAjaxError(function(){
    alert('Refresh token is invalid!');
});
                

refreshAjaxSuccess

This function is called when the user gets a new refresh token.
Parameters:
func: The function you want to invoke.
//Setting the refreshAjaxSuccess function
$AA.token().refreshAjaxSuccess(function(){
    alert('Token refreshed!');
});
                

passwordLogin

Use this function to log in using user name and password.
Parameters:
obj: The object containing the user name and password.
Request
Response
//Logging in with username and password
$AA.token().passwordLogin({
    username: "john.doe@gmail.com",
    password: "password123"
});
                
//The content of the response:
{
    access_token: "414a560e13c945f1bf0c384e36899d68197b7618"
    expires_in: 600 //access token expiration time in seconds
    refresh_token: "fb4534a7829f684ddf99bab0ccb31974c172556f"
    scope: null
    token_type: "Bearer"
}
                
Returns: jqXHR

credentialsLogin

Use this function to log in with cliendId and clientSecret.
Parameters:
obj: The object containing the cliendId and clientSecret key-value pairs.
Request
Response
//Logging in with cliendId and clientSecret
$AA.token().credentialsLogin({
    clientId: "test@gmail.com/accountname/api",
    clientSecret: "aB1c23DE4fGh5i67JKlmN89op"
}); //returns object with refresh and access token
                
//The content of the response:
{
    access_token: "414a560e13c945f1bf0c384e36899d68197b7618"
    expires_in: 600 //access token expiration time in seconds
    refresh_token: "fb4534a7829f684ddf99bab0ccb31974c172556f"
    scope: null
    token_type: "Bearer"
}
                
Returns: jqXHR

login

Use this function to log in with username and password or cliendId and clientSecret key-value pairs.
The program can decide which type of login you use based on the object keys.
Parameters:
obj: The object containing the login data.
Request
Response
//Logging in with username and password or cliendId and clientSecret
$AA.token().login({
    username: "john.doe@gmail.com",
    password: "password123"
}); //returns object with refresh and access token

$AA.token().login({
    clientId: "test@gmail.com/accountname/api",
    clientSecret: "aB1c23DE4fGh5i67JKlmN89op"
}); //returns object with refresh and access token
                
//The content of the response:
{
    access_token: "414a560e13c945f1bf0c384e36899d68197b7618"
    expires_in: 600 //access token expiration time in seconds
    refresh_token: "fb4534a7829f684ddf99bab0ccb31974c172556f"
    scope: null
    token_type: "Bearer"
}
                
Returns: jqXHR

logout

Use this function to log out.
All tokens will be deleted.
//Logging out
$AA.token().logout();
                

loggedIn

Use this function to check if you're logged in.
//Checking of you're logged in
$AA.token().loggedIn(); //returns true or false
                
Returns: Boolean

Basic Functions

These are global functions which can be used on all modules.

insert

Use this function to insert an element.
Parameters:
obj: the object representing the element you want to insert.
async: Not required, (true by default). Set it false to execute the insertion synchronously.
Request
Response
//Inserting a new segment
$AA.segments().insert({name: 'new segment'}, true)
                
//Response is the new segment object
{
    id:3,
    name:"new segment",
    createDate:{
        date:"2015-05-07 13:01:26",
        timezone_type:3,
        timezone:"Europe\/Budapest"
    },
    subscriberCount:0,
    conditions:[],
    _links:{
        self:{
            href:"https:\/\/api.automizy.com\/segments"
        },
        calculate:{
            href:"https:\/\/api.automizy.com\/segments\/3\/calculate"
        }
    }
}
                
Returns: jqXHR

insertSync

Use this function to insert an element sychronously. (The browser will wait for the response.)
Parameters:
obj: the object representing the element you want to insert.
Request
Response
//Inserting a new segment sychronously
$AA.segments().insertSync({name: 'new segment'})
                
//Response is the new segment object
{
    id:3,
    name:"new segment",
    createDate:{
        date:"2015-05-07 13:01:26",
        timezone_type:3,
        timezone:"Europe\/Budapest"
    },
    subscriberCount:0,
    conditions:[],
    _links:{
        self:{
            href:"https:\/\/api.automizy.com\/segments"
        },
        calculate:{
            href:"https:\/\/api.automizy.com\/segments\/3\/calculate"
        }
    }
}
                
Returns: jqXHR

update

Use this function to update a field of an element.
Parameters:
obj: The field you want to update and the new value.
id: The id of the element you want to update.
async: Not required, (true by default). Set it false to execute the update process synchronously.
Request
Response
//Changing the 'name' property of the first segment to 'First segment' asychronously
$AA.segments().update({'name':'First segment'},1, false);
                
//Response is the updated segment
{
    id:1,
    name:"First segment",
    createDate:{
        date:"2015-05-07 13:01:26",
        timezone_type:3,
        timezone:"Europe\/Budapest"
    },
    subscriberCount:0,
    conditions:[],
    _links:{
        self:{
            href:"https:\/\/api.automizy.com\/segments"
        },
        calculate:{
            href:"https:\/\/api.automizy.com\/segments\/3\/calculate"
        }
    }
}
                
Returns: jqXHR

updateSync

Use this function to update a field of an element sychronously. (The browser will wait for the response.)
Parameters:
obj: The field you want to update and the new value.
id: The id of the element you want to update.
Request
Response
//Changing the 'name' property of the first segment to 'First segment' sychronously
$AA.segments().update({'name':'First segment'},1);
                
//Response is the updated segment
{
    id:1,
    name:"First segment",
    createDate:{
        date:"2015-05-07 13:01:26",
        timezone_type:3,
        timezone:"Europe\/Budapest"
    },
    subscriberCount:0,
    conditions:[],
    _links:{
        self:{
            href:"https:\/\/api.automizy.com\/segments"
        },
        calculate:{
            href:"https:\/\/api.automizy.com\/segments\/3\/calculate"
        }
    }
}
                
Returns: jqXHR

get

Use this function to get the result of any query.
The result will be a jqXHR containing the elements which met the query's conditions.
There are several modifier methods which can be used before invoking the get() method:
  • fields('field1, field2'): If set, the response will contain only the value of the given fields.
  • limit(X): If set, only the first X results will be returned.
  • links('link1,link'): If set, only given links of the elements will appear in the result, all other links will be hidden.
  • orderBy('fieldName'): If set, the response will be ordered by the given field name. If you use ths funciton, you must invoke the orderDir() function too.
  • orderDir('orderDirection'): If set ('asc' || 'desc'), the response will be ordered by the given direction. If you use ths funciton, you must invoke the orderBy() function too.
  • order('orderBy:orderDir'): The composite function of the before mentioned ones. If set, the response will be ordered by the given field name and order direction.
  • page(pageNum): If set, the result will contain only those elements which can be found on the particular page.
  • where(conditionsArr): You can give condition to the query represented by an array.
Request
Response
//Get all segments
$AA.segments().get();
//Get all segments, with only the 'name' field. 
$AA.segments().fields('name').get();
//Get the first 3 segments
$AA.segments().limit(3).get();
//Get all segments with only 'self' link
$AA.segments().links('self').get();
//Order the segments by create date in ascending order
$AA.segments().orderBy('createDate').orderDir('asc').get();
$AA.segments().order('createDate:asc').get();
//Get all segments from the first page
$AA.segments().page(1).get();
//Get all segments that have 'test' in their name
$AA.segments().where([
    [
        ['name', 'in', '%test%']
    ]
]).get();
                
//Response is an array containing the requested segments
{
    segments:[
        //First segment
        {
            id:1,
            name:"First segment",
            createDate:{...},
            subscriberCount:0,
            conditions:[],
            _links:{...}
            }
        },
        //Following segments
        {..},
        {..},
        {..}
    ]
}
                
Returns: jqXHR

getSync

This function is the same as the get() method, but it works synchronously. (The browser will wait for the response.)
Request
Response
//Get all segments synchronously
$AA.segments().getSync();
                

//Response is an array containing the requested segments
{
    segments:[
        //First segment
        {
            id:1,
            name:"First segment",
            createDate:{...},
            subscriberCount:0,
            conditions:[],
            _links:{...}
            }
        },
        //Following segments
        {..},
        {..},
        {..}
    ]
}
                
Returns: jqXHR

getAll

Use this function to get all records in of the particular module.
If you use this function, it will ignore any modifier functions (like limit or where) and will return all results.
Request
Response
//Getting all segments
$AA.segments().limit(1).getAll(); //limit will be ignored!
                

//Response is an array containing all segments
{
    segments:[
        //First segment
        {
            id:1,
            name:"First segment",
            createDate:{...},
            subscriberCount:0,
            conditions:[],
            _links:{...}
            }
        },
        //Following segments
        {..},
        {..},
        {..}
    ]
}
                
Returns: jqXHR

getAllIdNamePair

Use this function to return all elements with their id-s and with their value in the selected field.
Parameters:
fieldName: The field whom value you want to get.
Request
Response
//Getting all segments with their id and name property
$AA.segments().getAllIdNamePair('name'); 
                
//Response is an array
[
    //First segment
    [
        0: 1,   //id
        1: "test1"  //value of selected field (name)
    ],
    //Second segment
    [
        0: 2,
        1: "new segment"
    ],
]
                
Returns: jqXHR

getFieldById

Use this function to get the value of the requested field of the record with the particular id.
Parameters:
id: The id of the record you want to inspect.
fieldName: The name of the fild you want to get.
Request
Response
//Returning the name property of the first segment
$AA.segments().getFieldById(1, 'name');
                
//Response is only the requested value
"test1"
                
Returns: jqXHR

getRecordById

Use this function to get a record with the particular id.
Parameters:
id: The id of the record you want to get.
Request
Response
//Getting the first segment
$AA.segments().getRecordById(1);
                
//Response is the updated segment
{
    id:1,
    name:"First segment",
    createDate:{
        date:"2015-05-07 13:01:26",
        timezone_type:3,
        timezone:"Europe\/Budapest"
    },
    subscriberCount:0,
    conditions:[],
    _links:{
        self:{
            href:"https:\/\/api.automizy.com\/segments"
        },
        calculate:{
            href:"https:\/\/api.automizy.com\/segments\/3\/calculate"
        }
    }
}
                
Returns: jqXHR

delete

Use this function to remove an element by id.
Parameters:
id: The id of the item you want to remove.
async: Not required, (true by default) set it false to execute the removal synchronously.
Request
Response
//Removing the 3rd segment asynchronously
$AA.segments().delete(3)
                
""
                
Returns: jqXHR

deleteSync

Use this function to remove an element by id synchronously.
Parameters:
id: The id of the item you want to remove.
Request
Response
//Removing the 3rd segment synchronously
$AA.segments().deleteSync(3)
                
""
                
Returns: jqXHR

Campaigns

These are special functions which can be used on campaigns
In addition, all Basic Functions can be invoked on campaigns.
To use these functions you have to invoke the $AA.campaigns() method first.
To see detailed structure and functionality of campaigns, check the Automizy REST API Docs

getOpenStatById

Use this function to get the number of opens.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting total and unique open statistics of the first campaign
$AA.campaigns().getOpenStatById(1);
                
{
    total: 2,
    unique: 1
}
                
Returns: jqXHR

getClickStatById

Use this function to get the number of clicks on your links in your given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting total and unique click statistics of the first campaign
$AA.campaigns().getClickStatById(1);
                
{
    total: 2,
    unique: 1
}
                
Returns: jqXHR

getShareStatById

Use this function to get the share statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting total and unique share statistics of the first campaign
$AA.campaigns().getShareStatById(1);
                
{
    total: 0,
    unique: 0
}
                
Returns: jqXHR

getUnsubscribeStatById

Use this function to get the number of contacts who clicked on the unsubscribe link in the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting total unsubscribe statistics of the first campaign
$AA.campaigns().getUnsubscribeStatById(1);
                
{
    total: 0
}
                
Returns: jqXHR

getBounceStatById

Use this function to get the bounce statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting soft and hard bounce statistics of the first campaign
$AA.campaigns().getBounceStatById(1);
                
{
    soft: 0,
    hard: 0
}
                
Returns: jqXHR

getGeoStatById

Use this function to get the geo statistics of the given campaign.
Please note that opens through proxy servers are not counted by this function.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting the geo statistics of the first campaign
$AA.campaigns().getGeoStatById(1);
                
//Response is an array, each element represents a region
[
    {
        count: "1",
        country: "HUNGARY",
        region: "BUDAPEST"
    },
    {
        count: "3",
        country: "USA",
        region: "FLORIDA"
    }
]
                
Returns: jqXHR

getOpenTimeLineById

Use this function to get the array representing the open time line statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting open time line statistics of the first campaign
$AA.campaigns().getOpenTimeLineById(1);
                
//Response is an array containing 31 elements
[
    //First timeframe
    {
        date :{
                date: "15-05-06 02:08:44",
                timezone_type:3,
                timezone:"Europe\/Budapest"
            },
        value{
            all: {
                total: 3,
                unique: 2
            }
        }
    },
    //Following timeframes
    {
        date :{
                date: "15-05-06 03:10:15",
                timezone_type:3,
                timezone:"Europe\/Budapest"
            },
        value{
            all: {
                total: 3,
                unique: 2
            }
        }
    },
    {},
    .
    .
    .
]
                
Returns: jqXHR

getClickTimeLineById

Use this function to get the array representing the click time line statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting click time line statistics of the first campaign
$AA.campaigns().getClickTimeLineById(1);
                
//Response is an array containing 31 elements
[
    //First timeframe
    {
        date :{
                date: "15-05-06 02:08:44",
                timezone_type:3,
                timezone:"Europe\/Budapest"
            },
        value{
            all: {
                total: 3,
                unique: 2
            }
        }
    },
    //Following timeframes
    {
        date :{
                date: "15-05-06 03:10:15",
                timezone_type:3,
                timezone:"Europe\/Budapest"
            },
        value{
            all: {
                total: 3,
                unique: 2
            }
        }
    },
    {},
    .
    .
    .
]
                
Returns: jqXHR

getOpenDevicePieById

Use this function to get the array representing the pie chart of opens, showing device statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting pie chart of open device statistics of the first campaign
$AA.campaigns().getOpenDevicePieById(1);
                
{
    "PC\/Laptop": 10,
    "Mobile": 3
}
                
Returns: jqXHR

getClickDevicePieById

Use this function to get the array representing the pie chart of clicks, showing device statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting pie chart of click device statistics of the first campaign
$AA.campaigns().getClickDevicePieById(1);
                
{
    "PC\/Laptop": 3,
    "Mobile": 1
}
                
Returns: jqXHR

getOpenOsPieById

Use this function to get the array representing the pie chart of opens, showing operating system device statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting pie chart of opens, showing operating system device statistics of the first campaign
$AA.campaigns().getOpenOsPieById(1);
                
{
    "Windows": 10,
    "Linux": 3
}
                
Returns: jqXHR

getClickOsPieById

Use this function to get the array representing the pie chart of clicks, showing operating system device statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting pie chart of clicks, showing operating system device statistics of the first campaign
$AA.campaigns().getClickOsPieById(1);
                
{
    "Windows": 3,
    "Linux": 1
}
                
Returns: jqXHR

getOpenBrowserPieById

Use this function to get the array representing the pie chart of opens, showing browser statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting pie chart of opens, showing browser statistics of the first campaign
$AA.campaigns().getOpenBrowserPieById(1);
                
{
    "Firefox": 2,
    "Chrome": 5,
    "Chrome Mobile": 3
}
                
Returns: jqXHR

getClickBrowserPieById

Use this function to get the array representing the pie chart of clicks, showing browser statistics of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting pie chart of clicks, showing browser statistics of the first campaign
$AA.campaigns().getClickBrowserPieById(1);
                
{
    "Firefox": 1,
    "Chrome": 2,
    "Chrome Mobile": 1
}
                
Returns: jqXHR

getOpenDomainListById

Use this function to get the object representing the list of opens, showing domain statistics of the given campaign.
You can also use getOpenDomainPieById as an alias.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
limit: The maximum number of domains you want to get. Default: false, all domains returned.
uniqueContacts: Set it true to show unique opens only. false by default.
Request
Response
//Getting list of opens, showing domain statistics of the first campaign
$AA.campaigns().getOpenDomainListById(1);
                
{
    "gmail.com": 8,
    "hotmail.com": 2,
}
                
Returns: jqXHR

getClickDomainListById

Use this function to get the object representing the list of clicks, showing domain statistics of the given campaign.
You can also use getClickDomainPieById as an alias.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format).If false, endpoint will be the current date and time.
limit: The maximum number of domains you want to get. Default: false, all domains returned.
uniqueContacts: Set it true to show unique clicks only. false by default.
Request
Response
//Getting list of clicks, showing domain statistics of the first campaign
$AA.campaigns().getClickDomainListById(1);
                
{
    "gmail.com": 3,
    "hotmail.com": 1,
}
                
Returns: jqXHR

getDomainTopListById

Use this function to get the array showing domain statistics about the number of sent emails in descending order. The data shows how many emails were sent to a particular domain.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format).If false, endpoint will be the current date and time.
limit: The maximum number of domains you want to get. Default: false, all domains returned.
Request
Response
//Getting list about the number of sent emails, showing domain statistics of the first campaign
$AA.campaigns().getDomainTopListById(1);
                
[
    {
        "domain": "gmail.com",
        "sent": "120",
    },
    {
        "domain": "hotmail.com",
        "sent": "22",
    }
]
                
Returns: jqXHR

getHeatMapById

Use this function to get the clicked links of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
from: The startpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, startpoint will be the date when the campaign was sent.
to: The endpoint of the statistics. (date, yyyy-MM-dd hh:mm:ss format). If false, endpoint will be the current date and time.
Request
Response
//Getting the clicked links of the first campaign
$AA.campaigns().getHeatMapById(1);
                
//Response is an array, each element represents a link
[
    {
        count:"1",
        url: "[{webversion}]"
    },
    {
        count:"1",
        url: "[{unsubscribelink}]"
    }
]
                
Returns: jqXHR

getLinksById

Use this function to get the links in the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
Request
Response
//Getting the clicked links of the first campaign
$AA.campaigns().getLinksById(1);
                
//Response is an object, each element represents a link
{
    "[{unsubscribelink}]",
    "[{webversion}]",
    "[{confirmlink}]",
    "https://www.facebook.com/sharer/sharer.php?u=[{webversion}]"
}
                
Returns: jqXHR

getCombinedById

Use this function to get multiple types of data of the given campaign.
Parameters:
id: The id of the campaign you want to inspect.
data: The types of data you want to get. The keys of the response object will be the same you specified in the data object.
Request
Response
//Getting different types of data of the first campaign in different formats
$AA.campaigns().getCombinedById(1, {
    open: {
        type:'open',
        format:'total',
        from: "2015.11.01",
        to: "2015.11.10"
    },
    deviceOpenPie: {
        type:'open',
        format:'aggregate',
        groupBy: 'device',
        from: "2015.11.01",
        to: "2015.11.10"
    },
    geoChart: {
        type:'geo-location',
        format:'raw',
        from: "2015.11.01",
        to: "2015.11.10"
    }
});
                
{
    deviceOpenPie: {
        "PC\/Laptop": 10,
        "Mobile": 3
    },
    geoChart:[
        {
            count: "4",
            country: "HUNGARY",
            region: "BUDAPEST"
        },
        {
            count: "9",
            country: "USA",
            region: "FLORIDA"
        }
    ],
    open:{
        total: 13,
        unique: 8
    }
}
                
Returns: jqXHR

Contacts

All Basic Functions can be invoked on contacts.
To use the functions you have to invoke the $AA.contacts() method first.
To see detailed structure and functionality of contacts, check the Automizy REST API Docs

Custom Fields

All Basic Functions can be invoked on custom fields.
To use the functions you have to invoke the $AA.customFields() method first.
To see detailed structure and functionality of custom fields, check the Automizy REST API Docs

Jobs

All Basic Functions can be invoked on jobs.
To use the functions you have to invoke the $AA.jobs() method first.

Newsletters

All Basic Functions can be invoked on newsletters.
To use the functions you have to invoke the $AA.newsletters() method first.
To see detailed structure and functionality of newsletters, check the Automizy REST API Docs

copy

Use this function to copy an email.
Parameters:
id: The id of the newsletter you want to copy.
object: In this object, you can specify any changes you want to do on the copy. For example if you want to change the name just type {name : 'New Name'}.
However, there is a built-in object called copyData, which can help you adding prefixes/suffixes to your copied newsletter.
done: You can set a function you want to invoke after the copying is over.
//Copying the newsletter with id 1
$AA.newsletters().copy(1, {copyData:{prefix:'Copy - '}}, function(data){
    console.log(data); //The data of the copy
}).done(function(data){
    console.log(data); //The data of the original object
});
                
Returns: The original object (jqXHR)

Segments

These are special functions which can be used on segments.
In addition, all Basic Functions can be invoked on segments.
To use these functions you have to invoke the $AA.segments() method first.
To see detailed structure and functionality of segments, check the Automizy REST API Docs

calculateById

Use this function to calculate a segment wihtout saving.
Parameters:
id: The id of the segment you want to calculate.
Request
Response
//Calculating the first segment without save
$AA.segments().calculateById(1);
                
{
numberOfContacts: "100"
}
                
Returns: jqXHR

calculateAndSave

Use this function to calculate a segment with saving.
Parameters:
id: The id of the segment you want to calculate.
//Calculating the first segment with save
$AA.segments().calculateAndSave(1);
                
Returns: Boolean

Split Tests

These are special functions which can be used on split tests
In addition, all Basic Functions can be invoked on split tests.
To use these functions you have to invoke the $AA.splitTests() method first.
To see detailed structure and functionality of split tests, check the Automizy REST API Docs

send

Use this function to create and send a new split test.
Parameters:
obj: The object, specifying the split test you want to send.
This object has several parameters, all of them has to be defined to send the test correctly.
  • name: These name of the split test you want to send. If not set the system will generate a name from the the 'Split Test' prefix and the local time.
  • conditionCheckDelay: When sending split tests you have to set the duration of the test. You can set that time by giving the conditions below. Until the time is over the test counts the statistics. When the given time elapsed, the test will be completed.
    • days: The number of days you want the statistics to run.
    • hours: The number of hours you want the statistics to run.
    • minutes: The number of minutes you want the statistics to run.
  • sendTime: The exact time you want to send the test.
    For example: '2015-06-22 14:16:00'
  • percentage: When sending a split test you have to set the number of recipients, this can be set by giving a percentage. (100% will be all contacts from the selected segments.)
    The system will send the campaigns randomly to the given percentage of contacts.
  • winAction: The action you want to make when the test is sent, and the time is over.
    Possible values:
    'DO_NOTHING': There will be no action.
    'SEND_REMAINING': The winner campaign will be sent to the remaining contacts.
  • winCondition:The condition that determines how the winner campaign will be selected.
    Possible values:
    'MOST_EMAIL_OPEN': The winner campaing will be the one which has the highest number of opens.
    'MOST_LINK_CLICK': The winner campaign will be the one that has more click on its links.
  • segments: The array containing the id of segments you want to send the test to.
  • newsletters: The array containing the newsletters you want to send in the test. (Min: 2 - Max: 4)
    In each newsletters you send, you can modify the parameters below:
    • embedImages: Set it true if you want to send the embed pictures too. (false by default)
    • sendFromEmail: The email address that will be shown as 'from email'.
    • replyToEmail: When a contact receives your email and clicks reply, which email address should that reply be sent to.
    • sendFromName: The name of a person or a company that will be shown as 'from name'.
Request
Response
$AA.splitTests().send({
    name: 'My first split test',
    conditionCheckDelay: {
    //The test will run for 1 days, 2 hours and 30 minutes
        days: 1,
        hours: 2,
        minutes: 30
    },
    sendTime: '2015-06-22 14:00:00',
    percentage: 10,
    winAction: 'SEND_REMAINING',
    winCondition: 'MOST_LINK_CLICK',
    segments: [1,4,10],
    newsletters: [
        {
            newsletter: 3, //id
            name: 'Third campaign',
            embedImages: true,
            sendFromEmail: 'myemail@mymail.com',
            replyToEmail: 'myemail@mymail.com',
            sendFromName: 'John Doe',
        },
        {
            newsletter: 4, //id
            name: 'Fourth campaign',
            embedImages: false,
            sendFromEmail: 'myemail@mymail.com',
            replyToEmail: 'myemail@mymail.com',
            sendFromName: 'John Doe',
        }
    ]
});
                
{
    _links: Object,
    campaigns: Array[2],
    conditionCheck: null,
    firstConditionCheck: {
        days: 1,
        hours: 2,
        minutes: 30,
    },
    id: "36",
    job: Object,
    name: "My first split test",
    percentage: 10,
    status: "WAIT_UNTIL_SCHEDULE_TIME",
    winAction: "SEND_REMAINING",
    winCondition: "MOST_LINK_CLICK",
    winner: null
}
                
Returns: jqXHR

getOpenStatById

Use this function to get the number of opens.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting total and unique open statistics of the first split test
$AA.splitTests().getOpenStatById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        total: 2,
        type: "all",
        unique: 1
    },
    2:{
        total: 4,
        type: "all",
        unique: 3
    }
}
                
Returns: jqXHR

getClickStatById

Use this function to get the number of clicks on your links in your given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting total and unique click statistics of the first split test
$AA.splitTests().getClickStatById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        total: 2,
        type: "all",
        unique: 1
    },
    2:{
        total: 4,
        type: "all",
        unique: 3
    }
}
                
Returns: jqXHR

getShareStatById

Use this function to get the share statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting total and unique share statistics of the first split test
$AA.splitTests().getShareStatById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        total: 2,
        type: "all",
        unique: 1
    },
    2:{
        total: 4,
        type: "all",
        unique: 3
    }
}
                
Returns: jqXHR

getUnsubscribeStatById

Use this function to get the number of contacts who clicked on the unsubscribe link in the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting total unsubscribe statistics of the first split test
$AA.splitTests().getUnsubscribeStatById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        total: 2,
        type: "all"
    },
    2:{
        total: 4,
        type: "all"
    }
}
                
Returns: jqXHR

getBounceStatById

Use this function to get the bounce statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting soft and hard bounce statistics of the first split test
$AA.splitTests().getBounceStatById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        soft: 2,
        hard: 0,
        type: "all"
    },
    2:{
        soft: 0,
        hard: 0,
        type: "all"
    }
}
                
Returns: jqXHR

getOpenTimeLineById

Use this function to get the array representing the open time line statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting open time line statistics of the first split test
$AA.splitTests().getOpenTimeLineById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    //Results are represented by arrays
    1:
    [
        //Campaign 1, first timeframe
        {
            date :{
                    date: "15-05-06 02:08:44",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 0 //zero openings
        },
        //Campaign 1, following timeframes
        {
            date :{
                    date: "15-05-06 03:10:15",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 2  //two total openings
        },
        {},
        .
        .
        .
    ],

    1:
    [
        //Campaign 2, first timeframe
        {
            date :{
                    date: "15-05-06 02:08:44",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 0 //zero openings
        },
        //Campaign 2, following timeframes
        {
            date :{
                    date: "15-05-06 03:10:15",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 2  //two total openings
        },
        {},
        .
        .
        .
    ]
}
                
Returns: jqXHR

getClickTimeLineById

Use this function to get the array representing the click time line statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting click time line statistics of the first split test
$AA.splitTests().getClickTimeLineById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    //Results are represented by arrays
    1:
    [
        //Campaign 1, first timeframe
        {
            date :{
                    date: "15-05-06 02:08:44",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 0 //zero clicks
        },
        //Campaign 1, following timeframes
        {
            date :{
                    date: "15-05-06 03:10:15",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 2  //two total clicks
        },
        {},
        .
        .
        .
    ],

    1:
    [
        //Campaign 2, first timeframe
        {
            date :{
                    date: "15-05-06 02:08:44",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 0 //zero clicks
        },
        //Campaign 2, following timeframes
        {
            date :{
                    date: "15-05-06 03:10:15",
                    timezone_type:3,
                    timezone:"Europe\/Budapest"
                },
            value : 2  //two total clicks
        },
        {},
        .
        .
        .
    ]
}
                
Returns: jqXHR

getOpenDevicePieById

Use this function to get the array representing the pie chart of opens, showing device statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of open device statistics of the first split test
$AA.splitTests().getOpenDevicePieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "PC\/Laptop": 10,
        Mobile: 3
    },
    2:{
        "PC\/Laptop": 3,
        "Mobile": 2
    }
}
                
Returns: jqXHR

getClickDevicePieById

Use this function to get the array representing the pie chart of clicks, showing device statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of click device statistics of the first split test
$AA.splitTests().getClickDevicePieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "PC\/Laptop": 10,
        "Mobile": 3
    },
    2:{
        "PC\/Laptop": 3,
        "Mobile": 2
    }
}
                
Returns: jqXHR

getOpenOsPieById

Use this function to get the array representing the pie chart of opens, showing operating system device statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of opens, showing operating system device statistics of the first split test
$AA.splitTests().getOpenOsPieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "Windows": 10,
        "Linux": 3
    },
    2:{
        "Windows": 2,
        "Linux": 3
    }
}
                
Returns: jqXHR

getClickOsPieById

Use this function to get the array representing the pie chart of clicks, showing operating system device statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of clicks, showing operating system device statistics of the first split test
$AA.splitTests().getClickOsPieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "Windows": 10,
        "Linux": 3
    },
    2:{
        "Windows": 2,
        "Linux": 3
    }
}
                
Returns: jqXHR

getOpenBrowserPieById

Use this function to get the array representing the pie chart of opens, showing browser statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of opens, showing browser statistics of the first split test
$AA.splitTests().getOpenBrowserPieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "Firefox": 2,
        "Chrome": 5,
        "Chrome Mobile": 3
    },
    2:{
        "Firefox": 0,
        "Chrome": 3,
        "Chrome Mobile": 2
    }
}
                
Returns: jqXHR

getClickBrowserPieById

Use this function to get the array representing the pie chart of clicks, showing browser statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of clicks, showing browser statistics of the first split test
$AA.splitTests().getClickBrowserPieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "Firefox": 2,
        "Chrome": 5,
        "Chrome Mobile": 3
    },
    2:{
        "Firefox": 0,
        "Chrome": 3,
        "Chrome Mobile": 2
    }
}
                
Returns: jqXHR

getOpenDomainPieById

Use this function to get the array representing the pie chart of opens, showing domain statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of opens, showing domain statistics of the first split test
$AA.splitTests().getOpenDomainPieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "gmail.com": 3,
        "hotmail.com": 2
    },
    2:{
        "gmail.com": 5,
        "hotmail.com": 3
    }
}
                
Returns: jqXHR

getClickDomainPieById

Use this function to get the array representing the pie chart of clicks, showing domain statistics of the given split test.
Parameters:
id: The id of the split test you want to inspect.
Request
Response
//Getting pie chart of clicks, showing domain statistics of the first split test
$AA.splitTests().getClickDomainPieById(1);
                
//In the response object the keys are the id of the sent campaigns
{
    1:{
        "gmail.com": 3,
        "hotmail.com": 2
    },
    2:{
        "gmail.com": 5,
        "hotmail.com": 3
    }
}
                
Returns: jqXHR

Templates

All Basic Functions can be invoked on templates.
To use the functions you have to invoke the $AA.templates() method first.
To see detailed structure and functionality of templates, check the Automizy REST API Docs

copy

Use this function to copy an email.
Parameters:
id: The id of the template you want to copy.
object: In this object, you can specify any changes you want to do on the copy. For example if you want to change the name just type {name : 'New Name'}.
However, there is a built-in object called copyData, which can help you adding prefixes/suffixes to your copied template.
done: You can set a function you want to invoke after the copying is over.
//Copying the template with id 1
$AA.templates().copy(1, {copyData:{prefix:'Copy - '}}, function(data){
    console.log(data); //The data of the copy
}).done(function(data){
    console.log(data); //The data of the original object
});
                
Returns: The original object (jqXHR)

Users

All Basic Functions can be invoked on users.
To use the functions you have to invoke the $AA.users() method first.
To see detailed structure and functionality of users, check the Automizy REST API Docs

switch

Use this function to switch user.
Parameters:
user: The user name.
Request
Response
//Switch to "myotheruser" account
$AA.users().switch('myotheruser');
                
//The content of the response:
{
    access_token: "414a560e13c945f1bf0c384e36899d68197b7618"
    expires_in: 600 //access token expiration time in seconds
    refresh_token: "fb4534a7829f684ddf99bab0ccb31974c172556f"
    scope: null
    token_type: "Bearer"
}
                
Returns: jqXHR

Webhooks

All Basic Functions can be invoked on webhooks.
To use the functions you have to webhooks the $AA.webhooks() method first.
To see detailed structure and functionality of webhooks, check the Automizy REST API Docs