Administrate

Regions

Regions represent locations which events belong to.

A region is a member of the system module and provides information about a region which encapsulates event locations.

A region record holds the following information:

  • name
  • default_tax
  • countries
  • invoice_numbering
  • default_tax_id
  • company
  • company_id
  • mapped_countries
  • is_hidden
  • id

Getting Regions

GET /api/v2/system/regions/: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/system/regions/TL',
                         auth=('<username>', '<password>'))

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions/TL     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions/TL';
$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:
{
    "name": "Tomorrowland",
    "default_tax": null,
    "countries": [],
    "invoice_numbering": "region",
    "default_tax_id": null,
    "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,
    "id": "TL",
    "mapped_countries": [],
    "is_hidden": false
}

Getting more than one Region

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions';
$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:
[
    {
        "name": "Tomorrowland",
        "default_tax": null,
        "countries": [],
        "invoice_numbering": "region",
        "default_tax_id": null,
        "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,
        "id": "TL",
        "mapped_countries": [],
        "is_hidden": false
    },
    {
        "name": "United Queendom",
        "default_tax": null,
        "countries": [],
        "invoice_numbering": "company",
        "default_tax_id": null,
        "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,
        "id": "UQ",
        "mapped_countries": [],
        "is_hidden": false
    }
]

Filtering

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

Creating Regions

POST /api/v2/system/regions
Required fields:
  • company_id
  • invoice_numbering
  • id
  • name
statuscode 200:no error
statuscode 404:could not create
Using Python:
import json
import requests

data = {u'invoice_numbering': u'region', u'company_id': 1, u'name': u'Tomorrowland', u'id': u'TL'}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions',
                        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/system/regions     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"company_id": 1, "invoice_numbering": "region", "id": "TL", "name": "Tomorrowland"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions';
$data = array("invoice_numbering" => u'region', "company_id" => 1, "name" => u'Tomorrowland', "id" => u'TL');
$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:
{
    "name": "Tomorrowland",
    "default_tax": null,
    "countries": [],
    "invoice_numbering": "region",
    "default_tax_id": null,
    "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,
    "id": "TL",
    "mapped_countries": [],
    "is_hidden": false
}

Updating Regions

PUT /api/v2/system/regions/(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'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions/TL',
                        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/system/regions/TL     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"name": "My new value for name"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/system/regions/TL';
$data = array("name" => u'My new value for name');
$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:
{
    "name": "My new value for name",
    "default_tax": null,
    "countries": [],
    "invoice_numbering": "region",
    "default_tax_id": null,
    "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,
    "id": "TL",
    "mapped_countries": [],
    "is_hidden": false
}