Administrate

Marketing Campaigns

Marketing Campaigns represent collections of marketing activities.

A marketing campaign is a member of the crm module

  • actual_contacts
  • actual_leads
  • description
  • end_date
  • activities
  • actual_conversions
  • target_submissions
  • company_id
  • tag_id
  • start_date
  • currency
  • tag
  • actual_submissions
  • target_contacts
  • target_conversions
  • is_finished
  • target_leads
  • contributions
  • id
  • target_sales
  • name

Getting Marketing Campaigns

GET /api/v2/crm/marketing_campaigns/: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_campaigns/4',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns/4     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns/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:
{
    "actual_contacts": 0,
    "description": "Selling stuff",
    "end_date": "2013-09-01",
    "activities": [],
    "name": "My campaign",
    "actual_conversions": 0,
    "company_id": null,
    "tag_id": null,
    "target_submissions": null,
    "currency": null,
    "is_finished": false,
    "tag": null,
    "id": 4,
    "target_sales": null,
    "target_contacts": null,
    "target_conversions": null,
    "actual_leads": 0,
    "contributions": [],
    "start_date": "2013-05-20",
    "actual_submissions": 0,
    "target_leads": null
}

Getting more than one Marketing Campaign

GET /api/v2/crm/marketing_campaigns
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_campaigns',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns';
$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:
[
    {
        "actual_contacts": 0,
        "description": "Selling stuff",
        "end_date": "2013-09-01",
        "name": "My campaign",
        "actual_conversions": 0,
        "company_id": null,
        "tag_id": null,
        "target_submissions": null,
        "currency": null,
        "is_finished": false,
        "tag": null,
        "id": 2,
        "target_sales": null,
        "target_contacts": null,
        "target_conversions": null,
        "actual_leads": 0,
        "contributions": [],
        "start_date": "2013-05-20",
        "actual_submissions": 0,
        "target_leads": null
    },
    {
        "actual_contacts": 0,
        "description": "Selling more stuff",
        "end_date": "2013-12-31",
        "name": "Another campaign",
        "actual_conversions": 0,
        "company_id": null,
        "tag_id": null,
        "target_submissions": null,
        "currency": null,
        "is_finished": false,
        "tag": null,
        "id": 3,
        "target_sales": null,
        "target_contacts": null,
        "target_conversions": null,
        "actual_leads": 0,
        "contributions": [],
        "start_date": "2013-02-01",
        "actual_submissions": 0,
        "target_leads": null
    }
]

Filtering

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

Creating Marketing Campaigns

POST /api/v2/crm/marketing_campaigns
Required fields:
  • start_date
  • name
  • end_date
  • description
statuscode 200:no error
statuscode 404:could not create
Using Python:
import json
import requests

data = {u'description': u'Selling stuff', u'start_date': u'2013-05-20', u'end_date': u'2013-09-01', u'name': u'My campaign'}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns',
                        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_campaigns     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"start_date": "2013-05-20", "name": "My campaign", "end_date": "2013-09-01", "description": "Selling stuff"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns';
$data = array("description" => u'Selling stuff', "start_date" => u'2013-05-20', "end_date" => u'2013-09-01', "name" => u'My campaign');
$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:
{
    "actual_contacts": 0,
    "description": "Selling stuff",
    "end_date": "2013-09-01",
    "activities": [],
    "name": "My campaign",
    "actual_conversions": 0,
    "company_id": null,
    "tag_id": null,
    "target_submissions": null,
    "currency": null,
    "is_finished": false,
    "tag": null,
    "id": 4,
    "target_sales": null,
    "target_contacts": null,
    "target_conversions": null,
    "actual_leads": 0,
    "contributions": [],
    "start_date": "2013-05-20",
    "actual_submissions": 0,
    "target_leads": null
}

Updating Marketing Campaigns

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

data = {u'name': u'My new value for name', u'start_date': u'2010-01-25'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns/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_campaigns/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"name": "My new value for name", "start_date": "2010-01-25"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns/6';
$data = array("name" => u'My new value for name', "start_date" => u'2010-01-25');
$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:
{
    "actual_contacts": 0,
    "description": "Selling stuff",
    "end_date": "2013-09-01",
    "activities": [],
    "name": "My new value for name",
    "actual_conversions": 0,
    "company_id": null,
    "tag_id": null,
    "target_submissions": null,
    "currency": null,
    "is_finished": false,
    "tag": null,
    "id": 6,
    "target_sales": null,
    "target_contacts": null,
    "target_conversions": null,
    "actual_leads": 0,
    "contributions": [],
    "start_date": "2010-01-25",
    "actual_submissions": 0,
    "target_leads": null
}

Deleting Marketing Campaigns

DELETE /api/v2/crm/marketing_campaigns/(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_campaigns/1',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns/1     -X DELETE -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_campaigns/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:
{
    "actual_contacts": 0,
    "description": "Selling stuff",
    "end_date": "2013-09-01",
    "activities": [],
    "name": "My campaign",
    "actual_conversions": 0,
    "company_id": null,
    "tag_id": null,
    "target_submissions": null,
    "currency": null,
    "is_finished": false,
    "tag": null,
    "id": 1,
    "target_sales": null,
    "target_contacts": null,
    "target_conversions": null,
    "actual_leads": 0,
    "contributions": [],
    "start_date": "2013-05-20",
    "actual_submissions": 0,
    "target_leads": null
}