Administrate

Tax Types

Tax Types represent the tax rates that you pay for different kinds of tax in different locations.

Fields

  • rate
  • hidden
  • credit_account_id
  • id
  • name

Getting Tax Types

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types/4     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types/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:
{
    "rate": 20.0,
    "credit_account_id": 1,
    "hidden": false,
    "name": "UK VAT",
    "id": 4
}

Getting more than one Tax Types

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types     -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types';
$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:
[
    {
        "rate": 20.0,
        "credit_account_id": 1,
        "hidden": false,
        "name": "UK VAT",
        "id": 2
    },
    {
        "rate": 0.0,
        "credit_account_id": 1,
        "hidden": false,
        "name": "No Tax",
        "id": 3
    }
]

Filtering

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

Creating Tax Types

POST /api/v2/finance/tax_types
Required fields:
  • rate
  • name
statuscode 200:no error
statuscode 404:could not create
Using Python:
import json
import requests

data = {u'rate': 20.0, u'credit_account_id': 1, u'hidden': False, u'name': u'UK VAT'}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types',
                        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/finance/tax_types     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"rate": 20.0, "hidden": false, "credit_account_id": 1, "name": "UK VAT"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types';
$data = array("rate" => 20.0, "credit_account_id" => 1, "hidden" => False, "name" => u'UK VAT');
$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:
{
    "rate": 20.0,
    "credit_account_id": 1,
    "hidden": false,
    "name": "UK VAT",
    "id": 4
}

Updating Tax Types

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

data = {u'rate': 100.0, u'name': u'My new value for name'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types/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/finance/tax_types/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"rate": 100.0, "name": "My new value for name"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types/6';
$data = array("rate" => 100.0, "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:
{
    "rate": 100.0,
    "credit_account_id": 1,
    "hidden": false,
    "name": "My new value for name",
    "id": 6
}

Deleting Tax Types

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

print response.json
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types/1     -X DELETE -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/finance/tax_types/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:
{
    "rate": 20.0,
    "credit_account_id": 1,
    "hidden": false,
    "name": "UK VAT",
    "id": 1
}