Taxes | Get Taxes

Getting Taxes (VAT) Data

This document outlines the procedure for making API calls to retrieve tax data using the get_taxes endpoint at https://easycms.fi/public_api/get_taxes/. Utilize various parameters to filter and customize your data retrieval.

Taxes Data Retrieval

Fetch tax data effectively using the below API call. Apply the IN, NOT_IN, or other relevant parameters as an array or a single integer to filter results according to your specific needs.

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/get_taxes/
  • Method: POST

Parameters | Payload

Each parameter can be used individually or in combination to refine your data retrieval:

  • TOKEN (api_key): Your unique API key for authentication. How to Create API Credentials.
  • username: Your login username.
  • password: Your login password.
  • account: Your specific account ID.
  • Pagination: To manage data effectively, this endpoint supports fetching up to 50 taxes at a time.
    • start - Specify the starting point from which to begin fetching taxes.
    • limit - Control the number of taxes returned in a single request. The maximum limit is 50, but you can opt for a smaller number based on your needs.
  • Filters:
    • IN - Specify Tax IDs to include specific taxes (optional, array or single integer).
    • NOT_IN - Specify Tax IDs to exclude specific taxes (optional, array or single integer).



Call Examples in Different Languages


curl -X POST 'https://easycms.fi/public_api/get_taxes' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID'

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://easycms.fi/public_api/get_taxes",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => http_build_query(['username' => 'USERNAME', 'password' => 'PASSWORD', 'account' => 'ACCOUNT_ID']),
  CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

import requests
url = "https://easycms.fi/public_api/get_taxes"
headers = {"Authorization1": "TOKEN"}
payload = {'username': 'USERNAME', 'password': 'PASSWORD', 'account': 'ACCOUNT_ID'}
response = requests.post(url, headers=headers, data=payload)
print(response.text)

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://easycms.fi/public_api/get_taxes"))
    .headers("Authorization1", "TOKEN")
    .POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID"))
    .build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

const https = require('https');
const data = new URLSearchParams({ 
  username: 'USERNAME', 
  password: 'PASSWORD', 
  account: 'ACCOUNT_ID'
}).toString();
const options = {
  hostname: 'prolasku.fi',
  path: '/public_api/get_taxes',
  method: 'POST',
  headers: {
    'Authorization1': 'TOKEN',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': data.length
  }
};
const req = https.request(options, (res) => {
  let data = '';
  res.on('data', (chunk) => { data += chunk; });
  res.on('end', () => { console.log(data); });
});
req.on('error', (e) => { console.error(e); });
req.write(data);
req.end();

import React, { useEffect, useState } from 'react';
function App() {
  const [categoryData, setCategoryData] = useState('');
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch('https://easycms.fi/public_api/get_taxes', {
          method: 'POST',
          headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
          body: new URLSearchParams({username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID'}).toString()
        });
        const data = await response.text();
        setCategoryData(data);
      } catch (error) {
        console.error(error);
      }
    };
    fetchData();
  }, []);
  return (
{categoryData}
); } export default App;

// Kotlin example requires using a third-party library like OkHttp for POST requests with a body
// Kotlin Example using OkHttp for POST request
import okhttp3.OkHttpClient
import okhttp3.FormBody
import okhttp3.Request

fun main() {
    val client = OkHttpClient()

    val formBody = FormBody.Builder()
        .add("username", "USERNAME")
        .add("password", "PASSWORD")
        .add("account", "ACCOUNT_ID")
        .build()

    val request = Request.Builder()
        .url("https://easycms.fi/public_api/get_taxes")
        .post(formBody)
        .addHeader("Authorization1", "TOKEN")
        .build()

    client.newCall(request).execute().use { response ->
        if (!response.isSuccessful) throw IOException("Unexpected code $response")

        println(response.body?.string())
    }
}

using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
    static async Task Main()
    {
        var token = "TOKEN";
        var content = new FormUrlEncodedContent(new[]
        {
            new KeyValuePair("username", "USERNAME"),
            new KeyValuePair("password", "PASSWORD"),
            new KeyValuePair("account", "ACCOUNT_ID")
        });
        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Add("Authorization1", token);
            var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_taxes", content);
            if (response.IsSuccessStatusCode)
            {
                var responseData = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}

Handling Endpoint Results

When you make a request to the endpoint, you receive a JSON response containing various keys and values. Here's an explanation of the response keys and their meanings:


- `vatId`: VAT ID (String) - A unique identifier for the VAT (Value Added Tax) category.
- `cr_tax_id`: CR Tax ID (String) - A unique identifier, typically in UUID format, for the tax category.
- `cr_tax_name`: CR Tax Name (String) - The name of the tax category, often including the tax rate and a code.
- `tax_desc`: Tax Descriptions (Object) - An object containing the description of the tax in different languages.
  - `bn`, `cs`, `da`, `de`, `es`, `et`, `fi`, `fr`, `hr`, `lt`, `lv`, `ne`, `nl`, `no`, `pl`, `ru`, `sv`, `th`, `vi`, `zh`, `en_gb`, `en_us`, `fa_ir`: Tax description in various languages (String).
- `vat_name`: VAT Name (Integer) - The name associated with the VAT, typically a numerical value.
- `vatNumber`: VAT Number (String) - A numerical identifier for the VAT.
- `visible`: Visibility Status (String) - Indicates whether the VAT category is visible ("1") or not ("0").
- `parent_id`: Parent VAT ID (Integer) - The identifier of the parent VAT category, if applicable.
- `vat_code`: VAT Code (String) - A specific code associated with the VAT category.
    

 "INFO": {
        "start": 0,
        "limit": 50,
        "count": 35,
        "total_count": "35",
        "tip": "You may pass the table's main column identifier ex: city_id for tbl_cities, pid for tbl_products, cid for tbl_categories etc... to make a request for a single specific id from your query. EXAMPLE PARAM: city_id = 2 when sending the request for \"get_cities\" "
    },
    "OUTPUT": [
        {
            "vatId": "1",
            "cr_tax_id": "1623017801-768f3f7a-de86-4d3c-ac91-af4828e30c87",
            "cr_tax_name": "ALV 0% [3000]",
            "tax_desc": {
                "bn": "বিক্রয় স্বদেশ ভ্যাট 0%",
                "cs": "Prodej vlast DPH 0%",
                "da": "Salg homeland MOMS 0%",
                "de": "Sales Heimat MwSt 0%",
                "es": "Las ventas de la patria IVA 0%",
                "et": "Müük kodumaa KÄIBEMAKSU 0%",
                "fi": "Myynti ALV Kotimaa 0%",
                "fr": "Vente patrie TVA à 0%",
                "hr": "Prodaje Domovine PDV-a 0%",
                "lt": "Pardavimo tÄ—vynÄ—s PVM 0%",
                "lv": "Pārdošanas dzimteni PVN 0%",
                "ne": "बिक्री मातृभूमि VAT 0%",
                "nl": "Verkoop vaderland BTW 0%",
                "no": "Salg homeland MVA-0%",
                "pl": "Sprzedaży Ojczyzny VAT 0%",
                "ru": "Продажи Родины НДС 0%",
                "sv": "Försäljning hemland MOMS 0%",
                "th": "ขายความมั่นคงแห่งมาตุภูมิลงแล้วปล่อ 0%",
                "vi": "Bán hàng quê hương THUẾ 0%",
                "zh": "销售祖国的增值税0%",
                "en_gb": "Sales homeland VAT 0%",
                "en_us": "Sales homeland VAT 0%",
                "fa_ir": "فروش میهن مالیات بر ارزش افزوده 0%"
            },
            "vat_name": 0,
            "vatNumber": "1",
            "visible": "1",
            "parent_id": 0,
            "vat_code": "MYK0",
            "vat_account": "3000"
        },
        {
            "vatId": "2",
            "cr_tax_id": "1623017801-8a13ae73-f391-4f25-9999-5a96fb316a9e",
            "cr_tax_name": "ALV 14% [3001]",
            "tax_desc": {
                "cs": "Prodej vlast DPH 14%",
                "da": "Salg homeland MOMS 14%",
                "de": "Sales Heimat MwSt 14%",
                "es": "Las ventas de la patria IVA 14%",
                "et": "Müük kodumaa KÄIBEMAKSU 14%",
                "fi": "Myynti ALV Kotimaa 14%",
                "fr": "Vente patrie de TVA de 14%",
                "hr": "Prodaje Domovine PDV-a 14%",
                "lt": "Pardavimo tėvynės PVM 14%",
                "lv": "Pārdošanas dzimteni PVN 14%",
                "nl": "Verkoop vaderland BTW 14%",
                "pl": "Sprzedaży Ojczyzny VAT 14%",
                "en_gb": "Sales homeland VAT 14%",
                "en_us": "Sales homeland VAT 14%"
            },
            "vat_name": 14,
            "vatNumber": "2",
            "visible": "1",
            "parent_id": 0,
            "vat_code": "MYK14",
            "vat_account": "3001"
        },
        {
            "vatId": "3",
            "cr_tax_id": "1623017801-83b86f44-be27-442b-abcd-cddc429b06c3",
            "cr_tax_name": "ALV 24% [3002]",
            "tax_desc": {
                "bn": "বিক্রয় স্বদেশ ভ্যাট 24%",
                "cs": "Prodej vlast DPH 24%",
                "da": "Salg homeland MOMS 24%",
                "de": "Sales Heimat MwSt 24%",
                "es": "Las ventas de la patria IVA 24%",
                "et": "Müük kodumaa KÄIBEMAKSU 24%",
                "fi": "Myynti ALV Kotimaa 24%",
                "fr": "Vente patrie de la TVA de 24%",
                "hr": "Prodaje Domovine PDV 24%",
                "lt": "Pardavimo tÄ—vynÄ—s PVM 24%",
                "lv": "Pārdošanas dzimteni PVN 24%",
                "ne": "बिक्री मातृभूमि VAT 24%",
                "nl": "Verkoop vaderland BTW-24%",
                "no": "Salg homeland MVA 24%",
                "pl": "Sprzedaży Ojczyzny VAT 24%",
                "ru": "Продажи Родины НДС 24%",
                "sv": "Försäljning hemland MOMS 24%",
                "th": "ขายความมั่นคงแห่งมาตุภูมิลงแล้วปล่ 24%",
                "vi": "Bán hàng quê hương THUẾ 24%",
                "zh": "销售祖国的增值税24%",
                "en_gb": "Sales homeland VAT 24%",
                "en_us": "Sales homeland VAT 24%",
                "fa_ir": "فروش میهن مالیات بر ارزش افزوده 24%"
            },
            "vat_name": 24,
            "vatNumber": "3",
            "visible": "1",
            "parent_id": 0,
            "vat_code": "MYK24",
            "vat_account": "3002"
        }
    ]

}
    

Error Handling

Here are the possible error messages and their meanings:

  • UN-AUTHORIZED - _user_name_password_is_set_but_wrong_value!: Incorrect username or password.
  • this_account_does_not_exist_or_your_credentials_do_not_match_this_account: The account doesn't exist or mismatched credentials.
  • UN-AUTHORIZED - header is set but the header value is not correct!: Incorrect authorization header value.
  • Maximum query size is 50 rows per query: Exceeded maximum limit of 50 rows per query.