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 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;

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

Example response:

{
    "rate": 20.0,
    "hidden": false,
    "credit_account_id": 1,
    "id": 4,
    "name": "UK VAT"
}

Getting more than one Tax Types

GET (/api/v2/finance/tax_types()

  • statuscode 200

    no error

  • statuscode 404

    does not exist

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;

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

Example response:

[
    {
        "rate": 20.0,
        "hidden": false,
        "credit_account_id": 1,
        "id": 2,
        "name": "UK VAT"
    },
    {
        "rate": 0.0,
        "hidden": false,
        "credit_account_id": 1,
        "id": 3,
        "name": "No Tax"
    }
]

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 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;

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

Example response:

{
    "rate": 20.0,
    "hidden": false,
    "credit_account_id": 1,
    "id": 4,
    "name": "UK VAT"
}

Updating Tax Types

PUT (/api/v2/finance/tax_types/(int: id)

  • statuscode 200

    no error

  • statuscode 404

    does not exist

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;

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

Example response:

{
    "rate": 100.0,
    "hidden": false,
    "credit_account_id": 1,
    "id": 6,
    "name": "My new value for name"
}

Deleting Tax Types

DELETE (/api/v2/finance/tax_types/(int: id)

  • statuscode 200

    deleted entity successfully

  • statuscode 404

    entity not found

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;

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

Example response:

{
    "rate": 20.0,
    "hidden": false,
    "credit_account_id": 1,
    "id": 1,
    "name": "UK VAT"
}