Administrate

Form Submissions

A form submission record holds the following information:

  • lead_id
  • dead_reason
  • created
  • marketing_activity_id
  • age
  • contact_id
  • dead_description
  • assignee_id
  • dead_reason_id
  • id
  • is_processed

Getting Form Submissions

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions/4     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions/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:
{
    "lead_id": null,
    "dead_reason": null,
    "created": "2012-03-04T00:00:00",
    "marketing_activity_id": 1,
    "age": 1731,
    "contact_id": 1,
    "id": 4,
    "assignee_id": 1,
    "dead_reason_id": null,
    "dead_description": null,
    "is_processed": false
}

Getting more than one form submission

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions';
$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:
[
    {
        "lead_id": null,
        "dead_reason": null,
        "created": "2012-03-04T00:00:00",
        "marketing_activity_id": 1,
        "age": 1731,
        "contact_id": 1,
        "id": 2,
        "assignee_id": 1,
        "dead_reason_id": null,
        "dead_description": null,
        "is_processed": false
    },
    {
        "lead_id": null,
        "dead_reason": null,
        "created": "2013-09-17T00:00:00",
        "marketing_activity_id": 1,
        "age": 1169,
        "contact_id": 2,
        "id": 3,
        "assignee_id": 1,
        "dead_reason_id": null,
        "dead_description": null,
        "is_processed": false
    }
]

Filtering

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

Creating Form Submissions

POST /api/v2/crm/form_submissions
Required fields:
  • assignee_id
  • marketing_activity_id
  • contact_id
statuscode 200:no error
statuscode 404:could not create
Using Python:
import json
import requests

data = {u'assignee_id': 1, u'marketing_activity_id': 1, u'contact_id': 1, u'created': u'2012-03-04'}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions',
                        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/form_submissions     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"assignee_id": 1, "marketing_activity_id": 1, "contact_id": 1, "created": "2012-03-04"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions';
$data = array("assignee_id" => 1, "marketing_activity_id" => 1, "contact_id" => 1, "created" => u'2012-03-04');
$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:
{
    "lead_id": null,
    "dead_reason": null,
    "created": "2012-03-04T00:00:00",
    "marketing_activity_id": 1,
    "age": 1731,
    "contact_id": 1,
    "id": 4,
    "assignee_id": 1,
    "dead_reason_id": null,
    "dead_description": null,
    "is_processed": false
}

Updating Form Submissions

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

data = {u'created': u'2009-01-25 14:15:16'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions/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/form_submissions/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"created": "2009-01-25 14:15:16"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions/6';
$data = array("created" => u'2009-01-25 14:15:16');
$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:
{
    "lead_id": null,
    "dead_reason": null,
    "created": "2009-01-25T14:15:16",
    "marketing_activity_id": 1,
    "age": 2865,
    "contact_id": 1,
    "id": 6,
    "assignee_id": 1,
    "dead_reason_id": null,
    "dead_description": null,
    "is_processed": false
}

Deleting Form Submissions

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions/1     -X DELETE -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/form_submissions/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:
{
    "lead_id": null,
    "dead_reason": null,
    "created": "2012-03-04T00:00:00",
    "marketing_activity_id": 1,
    "age": 1731,
    "contact_id": 1,
    "id": 1,
    "assignee_id": 1,
    "dead_reason_id": null,
    "dead_description": null,
    "is_processed": false
}