Administrate

Marketing Lists

Marketing Lists represent people in the system.

A contact is a member of the crm module and provides information about a system contact.

A contact record holds the following information:

  • description
  • contacts
  • company
  • company_id
  • source
  • marketing_contacts
  • id
  • name

Getting Marketing Lists

GET /api/v2/crm/marketing_lists/:id
statuscode 200:no error
statuscode 404:does not exist
Using Python:
import json
import requests

response = requests.get('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/4',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/4     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/4';
$options = array(
  'http' => array(
    'method'  => 'GET',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "description": "Mailout to people",
    "contacts": [],
    "company": {
        "registration_numbers": null,
        "code": "ACM",
        "name": "Acme Corporation",
        "settings": {
            "time_format": "H:i",
            "date_format": "Y-m-d",
            "locale": "en_GB",
            "week_starts": null,
            "non_working_days": null
        },
        "id": 1,
        "currency": {
            "html_code": null,
            "symbol": "\u00a3",
            "code": "GBP",
            "name": "British Pound Sterling",
            "is_base": true
        },
        "bank_details": null,
        "currency_code": "GBP",
        "account_id": null
    },
    "company_id": 1,
    "source": "Test 123",
    "marketing_contacts": [],
    "id": 4,
    "name": "My ML"
}

Getting more than one marketing list

GET /api/v2/crm/marketing_lists
statuscode 200:no error
statuscode 404:does not exist
Using Python:
import json
import requests

response = requests.get('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists';
$options = array(
  'http' => array(
    'method'  => 'GET',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
[
    {
        "company_id": 1,
        "source": "Test 123",
        "description": "Mailout to people",
        "name": "My ML",
        "id": 2
    },
    {
        "company_id": 1,
        "source": "The mind of schroedinger",
        "description": "Advertise stuff",
        "name": "Second ML",
        "id": 3
    }
]

Filtering

The results for a list of marketing_lists can be filtered. See Filtering

Creating Marketing Lists

POST /api/v2/crm/marketing_lists
Required fields:
  • source
  • name
  • company_id
statuscode 200:no error
statuscode 404:could not create
Using Python:
import json
import requests

data = {u'source': u'Test 123', u'description': u'Mailout to people', u'name': u'My ML', u'company_id': 1}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists',
                        data=json.dumps(data),
                        headers={'content-type': 'application/json'},
                        auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"source": "Test 123", "description": "Mailout to people", "company_id": 1, "name": "My ML"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists';
$data = array("source" => u'Test 123', "description" => u'Mailout to people', "name" => u'My ML', "company_id" => 1);
$options = array(
'http' => array(
'method'  => 'POST',
'content' => json_encode($data),
'header'=>  "Content-Type: application/json\r\n" .
            "Accept: application/json\r\n" .
            "Authorization: Basic " . base64_encode($credentials)
)
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "description": "Mailout to people",
    "contacts": [],
    "company": {
        "registration_numbers": null,
        "code": "ACM",
        "name": "Acme Corporation",
        "settings": {
            "time_format": "H:i",
            "date_format": "Y-m-d",
            "locale": "en_GB",
            "week_starts": null,
            "non_working_days": null
        },
        "id": 1,
        "currency": {
            "html_code": null,
            "symbol": "\u00a3",
            "code": "GBP",
            "name": "British Pound Sterling",
            "is_base": true
        },
        "bank_details": null,
        "currency_code": "GBP",
        "account_id": null
    },
    "company_id": 1,
    "source": "Test 123",
    "marketing_contacts": [],
    "id": 4,
    "name": "My ML"
}

Updating Marketing Lists

PUT /api/v2/crm/marketing_lists/(int: id)
statuscode 200:no error
statuscode 404:does not exist
Using Python:
import json
import requests

data = {u'source': u'My new value for source'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/6',
                        data=json.dumps(data),
                        headers={'content-type': 'application/json'},
                        auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"source": "My new value for source"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/6';
$data = array("source" => u'My new value for source');
$options = array(
'http' => array(
'method'  => 'PUT',
'content' => json_encode($data),
'header'=>  "Content-Type: application/json\r\n" .
            "Accept: application/json\r\n" .
            "Authorization: Basic " . base64_encode($credentials)
)
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "description": "Mailout to people",
    "contacts": [],
    "company": {
        "registration_numbers": null,
        "code": "ACM",
        "name": "Acme Corporation",
        "settings": {
            "time_format": "H:i",
            "date_format": "Y-m-d",
            "locale": "en_GB",
            "week_starts": null,
            "non_working_days": null
        },
        "id": 1,
        "currency": {
            "html_code": null,
            "symbol": "\u00a3",
            "code": "GBP",
            "name": "British Pound Sterling",
            "is_base": true
        },
        "bank_details": null,
        "currency_code": "GBP",
        "account_id": null
    },
    "company_id": 1,
    "source": "My new value for source",
    "marketing_contacts": [],
    "id": 6,
    "name": "My ML"
}

Deleting Marketing Lists

DELETE /api/v2/crm/marketing_lists/(int: id)
statuscode 200:deleted entity successfully
statuscode 404:entity not found
Using Python:
import json
import requests

response = requests.delete('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/1',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/1     -X DELETE -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_lists/1';
$options = array(
  'http' => array(
    'method'  => 'DELETE',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Example response:
{
    "description": "Mailout to people",
    "contacts": [],
    "company": {
        "registration_numbers": null,
        "code": "ACM",
        "name": "Acme Corporation",
        "settings": {
            "time_format": "H:i",
            "date_format": "Y-m-d",
            "locale": "en_GB",
            "week_starts": null,
            "non_working_days": null
        },
        "id": 1,
        "currency": {
            "html_code": null,
            "symbol": "\u00a3",
            "code": "GBP",
            "name": "British Pound Sterling",
            "is_base": true
        },
        "bank_details": null,
        "currency_code": "GBP",
        "account_id": null
    },
    "company_id": 1,
    "source": "Test 123",
    "marketing_contacts": [],
    "id": 1,
    "name": "My ML"
}