Administrate

Enquiries

Enquiries represent individual submitted requests for information.

An enquiry is a member of the crm module and provides information about a previous enquiry. An enquiry record holds the following information:

  • body
  • mimetype
  • to_email
  • from_name
  • is_processed
  • created
  • from_email
  • contact
  • assigned_to
  • id
  • subject

Getting Enquiries

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries/4     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries/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:
{
    "body": "hello",
    "mimetype": null,
    "to_email": "[email protected]",
    "from_name": "Joe Blow",
    "is_processed": false,
    "created": "2012-01-02T00:00:00",
    "from_email": "[email protected]",
    "contact": null,
    "assigned_to": 1,
    "id": 4,
    "subject": "Test subject"
}

Getting more than one Enquiry

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries';
$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:
[
    {
        "body": "hello",
        "mimetype": null,
        "to_email": "[email protected]",
        "from_name": "Joe Blow",
        "is_processed": false,
        "created": "2012-01-02T00:00:00",
        "from_email": "[email protected]",
        "contact": null,
        "assigned_to": 1,
        "id": 2,
        "subject": "Test subject"
    },
    {
        "body": "greetings",
        "mimetype": null,
        "to_email": "[email protected]",
        "from_name": "Fulano Beltrano",
        "is_processed": false,
        "created": "2012-02-03T00:00:00",
        "from_email": "[email protected]",
        "contact": null,
        "assigned_to": 1,
        "id": 3,
        "subject": "Testing again"
    }
]

Filtering

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

Creating Enquiries

POST /api/v2/crm/enquiries
Required fields:
  • body
  • to_email
  • from_name
  • created
  • from_email
  • subject
statuscode 200:no error
statuscode 404:could not create
Using Python:
import json
import requests

data = {u'body': u'hello', u'to_email': u'[email protected]', u'from_name': u'Joe Blow', u'created': u'2012-01-02', u'from_email': u'[email protected]', u'assigned_to': 1, u'subject': u'Test subject'}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries',
                        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/enquiries     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"body": "hello", "to_email": "[email protected]", "from_name": "Joe Blow", "created": "2012-01-02", "from_email": "[email protected]", "assigned_to": 1, "subject": "Test subject"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries';
$data = array("body" => u'hello', "to_email" => u'[email protected]', "from_name" => u'Joe Blow', "created" => u'2012-01-02', "from_email" => u'[email protected]', "assigned_to" => 1, "subject" => u'Test subject');
$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:
{
    "body": "hello",
    "mimetype": null,
    "to_email": "[email protected]",
    "from_name": "Joe Blow",
    "is_processed": false,
    "created": "2012-01-02T00:00:00",
    "from_email": "[email protected]",
    "contact": null,
    "assigned_to": 1,
    "id": 4,
    "subject": "Test subject"
}

Updating Enquiries

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

data = {u'body': u'My new value for body', u'created': u'2009-01-25 14:15:16'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries/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/enquiries/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"body": "My new value for body", "created": "2009-01-25 14:15:16"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries/6';
$data = array("body" => u'My new value for body', "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:
{
    "body": "My new value for body",
    "mimetype": null,
    "to_email": "[email protected]",
    "from_name": "Joe Blow",
    "is_processed": false,
    "created": "2009-01-25T14:15:16",
    "from_email": "[email protected]",
    "contact": null,
    "assigned_to": 1,
    "id": 6,
    "subject": "Test subject"
}

Deleting Enquiries

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries/1     -X DELETE -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/crm/enquiries/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:
{
    "body": "hello",
    "mimetype": null,
    "to_email": "[email protected]",
    "from_name": "Joe Blow",
    "is_processed": false,
    "created": "2012-01-02T00:00:00",
    "from_email": "[email protected]",
    "contact": null,
    "assigned_to": 1,
    "id": 1,
    "subject": "Test subject"
}