Marketing Activities

Marketing Activities represent individual promotions conducted. A marketing activity must belong to a marketing campaign.

A marketing activity is a member of the crm module.

  • campaign
  • type_id
  • campaign_id
  • currency
  • cost
  • purpose_id
  • id
  • actual_submissions
  • company_id
  • target_submissions
  • target_contacts
  • type
  • target_sales
  • description
  • actual_conversions
  • purpose
  • date
  • actual_contacts
  • name
  • region_categories
  • courses
  • target_conversions
  • is_finished

Getting Marketing Activities

GET (/api/v2/crm/marketing_activities/:id()

  • statuscode 200

    no error

  • statuscode 404

    does not exist

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities/4     -k -u (login):(password)

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities/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;

Using Python:

import json
import requests

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

print response.json

Example response:

{
    "campaign": {
        "actual_contacts": 0,
        "description": null,
        "end_date": null,
        "actual_conversions": 0,
        "target_submissions": null,
        "company_id": null,
        "tag_id": null,
        "start_date": null,
        "currency": null,
        "tag": null,
        "actual_submissions": 0,
        "target_contacts": null,
        "target_conversions": null,
        "is_finished": false,
        "contributions": [],
        "id": 1,
        "target_sales": null,
        "name": null
    },
    "type_id": null,
    "campaign_id": 1,
    "currency": null,
    "cost": null,
    "purpose_id": null,
    "id": 4,
    "actual_submissions": 0,
    "company_id": null,
    "target_submissions": null,
    "target_contacts": null,
    "type": null,
    "target_sales": null,
    "description": "Sell material objects to hominids",
    "actual_conversions": 0,
    "purpose": null,
    "date": null,
    "actual_contacts": 0,
    "name": "My MA",
    "region_categories": [],
    "courses": [],
    "target_conversions": null,
    "is_finished": false
}

Getting more than one Marketing Activity

GET (/api/v2/crm/marketing_activities()

  • statuscode 200

    no error

  • statuscode 404

    does not exist

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities     -k -u (login):(password)

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities';
$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;

Using Python:

import json
import requests

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

print response.json

Example response:

[
    {
        "campaign": {
            "actual_contacts": 0,
            "description": null,
            "end_date": null,
            "actual_conversions": 0,
            "target_submissions": null,
            "company_id": null,
            "tag_id": null,
            "start_date": null,
            "currency": null,
            "tag": null,
            "actual_submissions": 0,
            "target_contacts": null,
            "target_conversions": null,
            "is_finished": false,
            "contributions": [],
            "id": 1,
            "target_sales": null,
            "name": null
        },
        "type_id": null,
        "campaign_id": 1,
        "currency": null,
        "cost": null,
        "purpose_id": null,
        "id": 2,
        "actual_submissions": 0,
        "company_id": null,
        "target_submissions": null,
        "target_contacts": null,
        "type": null,
        "target_sales": null,
        "description": "Sell material objects to hominids",
        "actual_conversions": 0,
        "purpose": null,
        "date": null,
        "actual_contacts": 0,
        "name": "My MA",
        "region_categories": [],
        "courses": [],
        "target_conversions": null,
        "is_finished": false
    },
    {
        "campaign": {
            "actual_contacts": 0,
            "description": null,
            "end_date": null,
            "actual_conversions": 0,
            "target_submissions": null,
            "company_id": null,
            "tag_id": null,
            "start_date": null,
            "currency": null,
            "tag": null,
            "actual_submissions": 0,
            "target_contacts": null,
            "target_conversions": null,
            "is_finished": false,
            "contributions": [],
            "id": 1,
            "target_sales": null,
            "name": null
        },
        "type_id": null,
        "campaign_id": 1,
        "currency": null,
        "cost": null,
        "purpose_id": null,
        "id": 3,
        "actual_submissions": 0,
        "company_id": null,
        "target_submissions": null,
        "target_contacts": null,
        "type": null,
        "target_sales": null,
        "description": "Operation sell stuff",
        "actual_conversions": 0,
        "purpose": null,
        "date": null,
        "actual_contacts": 0,
        "name": "Second MA",
        "region_categories": [],
        "courses": [],
        "target_conversions": null,
        "is_finished": false
    }
]

Filtering

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

Creating Marketing Activities

POST (/api/v2/crm/marketing_activities()

Required fields:

  • description
  • campaign_id
  • name
  • statuscode 200

    no error

  • statuscode 404

    could not create

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"description": "Sell material objects to hominids", "campaign_id": 1, "name": "My MA"}'

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities';
$data = array("description" => u'Sell material objects to hominids', "name" => u'My MA', "campaign_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;

Using Python:

import json
import requests

data = {u'description': u'Sell material objects to hominids', u'name': u'My MA', u'campaign_id': 1}

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

print response.json

Example response:

{
    "campaign": {
        "actual_contacts": 0,
        "description": null,
        "end_date": null,
        "actual_conversions": 0,
        "target_submissions": null,
        "company_id": null,
        "tag_id": null,
        "start_date": null,
        "currency": null,
        "tag": null,
        "actual_submissions": 0,
        "target_contacts": null,
        "target_conversions": null,
        "is_finished": false,
        "contributions": [],
        "id": 1,
        "target_sales": null,
        "name": null
    },
    "type_id": null,
    "campaign_id": 1,
    "currency": null,
    "cost": null,
    "purpose_id": null,
    "id": 4,
    "actual_submissions": 0,
    "company_id": null,
    "target_submissions": null,
    "target_contacts": null,
    "type": null,
    "target_sales": null,
    "description": "Sell material objects to hominids",
    "actual_conversions": 0,
    "purpose": null,
    "date": null,
    "actual_contacts": 0,
    "name": "My MA",
    "region_categories": [],
    "courses": [],
    "target_conversions": null,
    "is_finished": false
}

Updating Marketing Activities

PUT (/api/v2/crm/marketing_activities/(int: id)

  • statuscode 200

    no error

  • statuscode 404

    does not exist

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"description": "My new value for description"}'

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities/6';
$data = array("description" => u'My new value for description');
$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;

Using Python:

import json
import requests

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

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

print response.json

Example response:

{
    "campaign": {
        "actual_contacts": 0,
        "description": null,
        "end_date": null,
        "actual_conversions": 0,
        "target_submissions": null,
        "company_id": null,
        "tag_id": null,
        "start_date": null,
        "currency": null,
        "tag": null,
        "actual_submissions": 0,
        "target_contacts": null,
        "target_conversions": null,
        "is_finished": false,
        "contributions": [],
        "id": 1,
        "target_sales": null,
        "name": null
    },
    "type_id": null,
    "campaign_id": 1,
    "currency": null,
    "cost": null,
    "purpose_id": null,
    "id": 6,
    "actual_submissions": 0,
    "company_id": null,
    "target_submissions": null,
    "target_contacts": null,
    "type": null,
    "target_sales": null,
    "description": "My new value for description",
    "actual_conversions": 0,
    "purpose": null,
    "date": null,
    "actual_contacts": 0,
    "name": "My MA",
    "region_categories": [],
    "courses": [],
    "target_conversions": null,
    "is_finished": false
}

Deleting Marketing Activities

DELETE (/api/v2/crm/marketing_activities/(int: id)

  • statuscode 200

    deleted entity successfully

  • statuscode 404

    entity not found

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities/1     -X DELETE -k -u (login):(password)

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/marketing_activities/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;

Using Python:

import json
import requests

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

print response.json

Example response:

{
    "campaign": {
        "actual_contacts": 0,
        "description": null,
        "end_date": null,
        "actual_conversions": 0,
        "target_submissions": null,
        "company_id": null,
        "tag_id": null,
        "start_date": null,
        "currency": null,
        "tag": null,
        "actual_submissions": 0,
        "target_contacts": null,
        "target_conversions": null,
        "is_finished": false,
        "contributions": [],
        "id": 1,
        "target_sales": null,
        "name": null
    },
    "type_id": null,
    "campaign_id": 1,
    "currency": null,
    "cost": null,
    "purpose_id": null,
    "id": 1,
    "actual_submissions": 0,
    "company_id": null,
    "target_submissions": null,
    "target_contacts": null,
    "type": null,
    "target_sales": null,
    "description": "Sell material objects to hominids",
    "actual_conversions": 0,
    "purpose": null,
    "date": null,
    "actual_contacts": 0,
    "name": "My MA",
    "region_categories": [],
    "courses": [],
    "target_conversions": null,
    "is_finished": false
}