NAV Navbar
php shell

Introduction

Welcome to the powerful TekBASE API! Our TekBASE is the most popular all-in-one management tool for game-, stream-, voice- and dedicated servers in Germany. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize, use this code:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);
curl_close($ch);
?>
curl "<TekBase-URL>/api/v2" \
     -H 'authenticate: apikey=<API-Key>'

Make sure to replace <TekBASE-URL> and <API-Key> with your Domain and API key.

TekBASE uses API keys to allow access to the API. You can see the API key in your admin panel. TekBASE expects for the API key to be included in all API requests to the server in a header that looks like the following:

authenticate: apikey=<API-Key>

Applications

These are the applications that are installed on the server and assigned to a customer.

Get all applications

<?php
$json_array = [];

/* optimized request
$json_array = [
  'fields' => [
    'memberid' => '1',
    'rserverid' => '1'
  ],
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/app" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"fields":{"memberid":"1","rserverid":"1"},"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "memberid": "1",
    "productid": "1",
    "name": "Test A",
    "serverip": "123.123.123.123",
    "serverport": "12345",
    "apps": "app_a",
    "path": "app_a_2342",
    "ftp": "1",
    "mrserver": "0",
    "rserverid": "1",
    "starttime": "mo=22:00\r\nwe=14:00"
  },
  {
    "id": 1,
    "memberid": "3",
    "productid": "0",
    "name": "Test B",
    "serverip": "123.123.123.123",
    "serverport": "23567",
    "apps": "app_b",
    "path": "app_b_1296",
    "ftp": "1",
    "mrserver": "0",
    "rserverid": "5",
    "starttime": "fr=04:00"
  }
]

Returns all existing application objects.

HTTP Request

GET http://example.com/api/v2/app

Request

The fields key in the request contains an array of field objects with this structure:

Parameter Type Description
memberid number¹ Can be used to filter applications by member ID from teklab_members => id.
apps string¹ Specifies which application was installed from teklab_apps => sname.
serverip string¹ The IP address of the server where the application was installed.
mrserver number¹ This indicates whether the application was installed on a customer root server. (0 = no, 1 = yes)
rserverid number¹ Unique ID of the root server from teklab_rootserver => id.

The db key in the request contains an array of database request optimizations, similar to ORDER BY apps ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. apps)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
memberid number Unique member ID from teklab_members => id.
productid number Unique product ID from teklab_members_product => id.
name string The name can be assigned by customers.
serverip string The IP address of the server where the application was installed.
serverport number Server port for this application.
apps string Specifies which application was installed from teklab_apps => sname.
path string Name of the folder in the directory /home/member/apps.
ftp number Specifies whether WebFTP is allowed for this application. (0 = deactivated, 1 = activated)
mrserver number This indicates whether the application was installed on a customer root server. (0 = no, 1 = yes)
rserverid number Unique ID of the root server from teklab_rootserver => id.
starttime string Settings for restart planning (e.g. mo=12:00 or tu=12:00\r\nwe=18:00\r\nsa=23:00 ...)

Get an application

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/app/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "memberid": "1",
  "productid": "1",
  "name": "Test A",
  "serverip": "123.123.123.123",
  "serverport": "12345",
  "apps": "app_a",
  "path": "app_a_2342",
  "ftp": "1",
  "mrserver": "0",
  "rserverid": "1",
  "starttime": "mo=22:00\r\nwe=14:00"
}

This endpoint retrieves a specific application.

HTTP Request

GET http://example.com/api/v2/app/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the application to retrieve.

Reply

Parameter Type Description
id number Unique ID
memberid number Unique member ID from teklab_members => id.
productid number Unique product ID from teklab_members_product => id.
name string The name can be assigned by customers.
serverip string The IP address of the server where the application was installed.
serverport number Server port for this application.
apps string Specifies which application was installed from teklab_apps => sname.
path string Name of the folder in the directory /home/member/apps.
ftp number Specifies whether WebFTP is allowed for this application. (0 = deactivated, 1 = activated)
mrserver number This indicates whether the application was installed on a customer root server. (0 = no, 1 = yes)
rserverid number Unique ID of the root server from teklab_rootserver => id.
starttime string Settings for restart planning (e.g. mo=12:00 or tu=12:00\r\nwe=18:00\r\nsa=23:00 ...)

Add an application

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'memberid' => '1',
  'productid' => '5',
  'name' => 'Test C',
  'serverip' => '123.123.123.123',
  'serverport' => '34567',
  'apps' => 'app_a',
  'path' => 'app_a_6731'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/app" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "memberid": "1",
    "productid": "5",
    "name": "Test C",
    "serverip": "123.123.123.123",
    "serverport": "34567",
    "apps": "app_a",
    "path": "app_a_6731"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new application in your TekBASE. For each root server there can be only one combination of the parameters "serverip" and "serverport". No duplicate entries.

HTTP Request

POST http://example.com/api/v2/app

Request

Parameter Type Description
memberid number¹ Unique member ID from teklab_members => id.
productid number Unique product ID from teklab_members_product => id.
name string The name can be assigned by customers.
serverip string¹ The IP address of the server where the application was installed.
serverport number Server port for this application.
apps string¹ Specifies which application was installed from teklab_apps => sname.
path string¹ Name of the folder in the directory /home/member/apps.
ftp number Specifies whether WebFTP is allowed for this application. (0 = deactivated, 1 = activated)
mrserver number This indicates whether the application was installed on a customer root server. (0 = no, 1 = yes)
rserverid number Unique ID of the root server from teklab_rootserver => id.
starttime string Settings for restart planning (e.g. mo=12:00 or tu=12:00\r\nwe=18:00\r\nsa=23:00 ...)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update an application

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'name' => 'Test D',
  'ftp' => '0',
  'starttime' => 'mo=23:00\r\nwe=24:00'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/app/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "name": "Test D",
    "ftp": "0",
    "starttime": "mo=23:00\r\nwe=24:00",
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update an application in your TekBASE. For each root server there can be only one combination of the parameters "serverip" and "serverport". No duplicate entries.

HTTP Request

POST http://example.com/api/v2/app/{id}

Request

Parameter Type Description
productid number Unique product ID from teklab_members_product => id.
name string The name can be assigned by customers.
serverip string¹² The IP address of the server where the application was installed.
serverport number² Server port for this application.
ftp number Specifies whether WebFTP is allowed for this application. (0 = deactivated, 1 = activated)
starttime string Settings for restart planning (e.g. mo=12:00 or tu=12:00\r\nwe=18:00\r\nsa=23:00 ...)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete an application

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/app/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific application.

HTTP Request

DELETE http://example.com/api/v2/app/{id}

Request

Parameter Type Description
id number (required) The ID of the application to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Application files

The customer can edit the added files in the File Editor. Otherwise the customer must use FTP or WebFTP. We recommend adding at least one of the settings files per application.

Get all files

<?php
$json_array = [];

/* optimized request
$json_array = [
  'fields' => [
    'apps' => 'app_a'
  ],
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/file?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/app/file" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"fields":{"apps":"app_a"},"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "file": "config.txt",
    "apps": "app_a",
    "path": ""
  },
  {
    "id": 2,
    "name": "settings.ini",
    "apps": "app_b",
    "path": "settings"
  }
]

Returns all existing application file objects.

HTTP Request

GET http://example.com/api/v2/app/file

Request

The fields key in the request contains an array of field objects with this structure:

Parameter Type Description
apps string¹ Can be used to filter files by applications. The response will only contain the files matching the specified application.

The db key in the request contains an array of database request optimizations, similar to ORDER BY apps ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. apps)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
file string File name without path specification.
apps string Abbreviation of the application name from teklab_apps => sname.
path string Starting from the current directory of the application.

Get a file

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/file/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/app/file/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "file": "config.txt",
  "apps": "app_a",
  "path": ""
}

This endpoint retrieves a specific application file.

HTTP Request

GET http://example.com/api/v2/app/file/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the application file to retrieve.

Reply

Parameter Type Description
id number Unique ID
file string File name without path specification.
apps string Abbreviation of the application name from teklab_apps => sname.
path string Starting from the current directory of the application.

Add a file

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/file');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'file' => 'config.ini',
  'apps' => 'app_c',
  'path' => ''
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/app/file" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "file": "config.ini",
    "apps": "app_c",
    "path": ""
  }'

The above command returns JSON structured like this:

{
  "id": "3"
  "message": "SUCCESSFUL"
}

Create a new application file in your TekBASE. For each application there can be only one combination of the parameters "file" and "apps". No duplicate entries.

HTTP Request

POST http://example.com/api/v2/app/file

Request

Parameter Type Description
file string¹ File name without path specification.
apps string¹ Abbreviation of the application name from teklab_apps => sname.
path string Starting from the current directory of the application.

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a file

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/file/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'file' => 'config.ini',
  'apps' => 'app_a',
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/app/file/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "file": "config.ini",
    "apps": "app_a",
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update an application file in your TekBASE. For each application there can be only one combination of the parameters "file" and "apps". No duplicate entries.

HTTP Request

POST http://example.com/api/v2/app/file/{id}

Request

Parameter Type Description
file string¹² File name without path specification.
apps string¹² Abbreviation of the application name from teklab_apps => sname.
path string Starting from the current directory of the application.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a file

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/file/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/app/file/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific application file.

HTTP Request

DELETE http://example.com/api/v2/app/file/{id}

Request

Parameter Type Description
id number¹ The ID of the application file to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Application list

The application contained in the "application list" can be installed on the servers.

Get all applications

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/list?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/app/list" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "Application A",
    "sname": "app_a",
    "script": "./app_start.sh -c config.txt -p gsport",
    "varnamea": "Debug Modus",
    "varscripta": "-d 10",
    "varnameb": "",
    "varscriptb": "",
    "pidfile": "app_a.pid",
    "updatescript": "wget ftp://xxxx/update/app_a_up.sh;chmod 0755 app_a_up.sh;./app_a_up.sh",
    "softlimit": "",
    "multi": "1"
  },
  {
    "id": 2,
    "name": "Application B",
    "sname": "app_b",
    "script": "./start.sh gsport",
    "varnamea": "",
    "varscripta": "",
    "varnameb": "",
    "varscriptb": "",
    "pidfile": "",
    "updatescript": "wget ftp://xxxx/update/app_b_up.sh;chmod 0755 app_b_up.sh;./app_b_up.sh",
    "softlimit": "",
    "multi": "1"
  }
]

Returns all existing application objects.

HTTP Request

GET http://example.com/api/v2/app/list

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY sname ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. sname)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
name string Unique name of the program.
sname string Unique abbreviation of the application name.
script text Start script of the program.
varnamea string Name of the variable A. If selected, the script is appended to the start script.
varscripta string Script for the variable A.
varnameb string Name of the variable B. If selected, the script is appended to the start script.
varscriptb string Script for the variable B.
pidfile string Some programs are not started with Screen but create a PID file on startup. This file is needed to stop the program.
updatescript text Update-script of the program.
softlimit string Not yet implemented. Limits the disk space for the program. (e.g. 500M or 1G ...)
multi number Availability of the programm image. (1 = 32Bit app_a.tar, 2 = 64Bit app_a-64.tar, 3 = Both)

Get an application

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/list/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/app/list/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Application A",
  "sname": "app_a",
  "script": "./app_start.sh -c config.txt -p gsport",
  "varnamea": "Debug Modus",
  "varscripta": "-d 10",
  "varnameb": "",
  "varscriptb": "",
  "pidfile": "app_a.pid",
  "updatescript": "wget ftp://xxxx/update/app_a_up.sh;chmod 0755 app_a_up.sh;./app_a_up.sh",
  "softlimit": "",
  "multi": "1"
}

This endpoint retrieves a specific application.

HTTP Request

GET http://example.com/api/v2/app/list/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the application to retrieve.

Reply

Parameter Type Description
id number Unique ID
name string Unique name of the program.
sname string Unique abbreviation of the application name.
script text Start script of the program.
varnamea string Name of the variable A. If selected, the script is appended to the start script.
varscripta string Script for the variable A.
varnameb string Name of the variable B. If selected, the script is appended to the start script.
varscriptb string Script for the variable B.
pidfile string Some programs are not started with Screen but create a PID file on startup. This file is needed to stop the program.
updatescript text Update-script of the program.
softlimit string Not yet implemented. Limits the disk space for the program. (e.g. 500M or 1G ...)
multi number Availability of the programm image. (1 = 32Bit app_a.tar, 2 = 64Bit app_a-64.tar, 3 = Both)

Add an application

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/list');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'name' => 'Application C',
  'sname' => 'app_c',
  'script' => './app_start.sh config.ini',
  'updatescript' => 'wget ftp://xxxx/update/app_c_up.sh;chmod 0755 app_c_up.sh;./app_c_up.sh',
  'multi' => '1'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/app/list" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "name": "Application C",
    "sname": "app_c",
    "script": "./app_start.sh config.ini",
    "updatescript": "wget ftp://xxxx/update/app_c_up.sh;chmod 0755 app_c_up.sh;./app_c_up.sh",
    "multi": "1"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new application in your TekBASE. For each application there can be only one "name" and "sname" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/app/list

Request

Parameter Type Description
name string¹ Unique name of the program.
sname string¹ Unique abbreviation of the application name.
script text¹ Start script of the program.
varnamea string Name of the variable A. If selected, the script is appended to the start script.
varscripta string Script for the variable A.
varnameb string Name of the variable B. If selected, the script is appended to the start script.
varscriptb string Script for the variable B.
pidfile string Some programs are not started with Screen but create a PID file on startup. This file is needed to stop the program.
updatescript text Update-script of the program.
softlimit string Not yet implemented. Limits the disk space for the program. (e.g. 500M or 1G ...)
multi number¹ Availability of the programm image. (1 = 32Bit app_a.tar, 2 = 64Bit app_a-64.tar, 3 = Both)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update an application

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/list/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'varscripta' => '-d 5',
  'varnameb' => 'Logfile output',
  'varscriptb' => '-l logs.txt'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/app/list/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "varscripta": "-d 5",
    "varnameb": "Logfile output",
    "varscriptb": "-l logs.txt",
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update an application in your TekBASE. For each application there can be only one "name" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/app/list/{id}

Request

Parameter Type Description
name string¹ Unique name of the program.
script text¹ Start script of the program.
varnamea string Name of the variable A. If selected, the script is appended to the start script.
varscripta string Script for the variable A.
varnameb string Name of the variable B. If selected, the script is appended to the start script.
varscriptb string Script for the variable B.
pidfile string Some programs are not started with Screen but create a PID file on startup. This file is needed to stop the program.
updatescript text Update-script of the program.
softlimit string Not yet implemented. Limits the disk space for the program. (e.g. 500M or 1G ...)
multi number¹ Availability of the programm image. (1 = 32Bit app_a.tar, 2 = 64Bit app_a-64.tar, 3 = Both)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete an application

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/app/list/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/app/list/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific application.

HTTP Request

DELETE http://example.com/api/v2/app/list/{id}

Request

Parameter Type Description
id number¹ The ID of the application list to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Countries

Manage the countries and assign the VAT and language file to them.

Get all countries

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/country?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/country" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "name": "Deutschland",
    "nametwo": "Germany",
    "language": "german",
    "short": "de",
    "taxid": "2",
    "active": "1"
  },
  {
    "id": 2,
    "name": "England",
    "nametwo": "United Kingdom",
    "language": "english",
    "short": "uk",
    "taxid": "3",
    "active": "1"
  }
]

Returns all existing country objects.

HTTP Request

GET http://example.com/api/v2/country

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY name ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. name)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
name string Unique name of the country in the primary language.
nametwo string Unique name of the country in the second language.
language string Name of the language file without file extension.
short string Two-digit country code. (e.g. uk)
taxid number Unique tax ID from teklab_finance_taxkeys => id.
active number Specifies whether the country can be used. (0 = deactivated, 1 = activated)

Get a country

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/country/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/country/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
 "id": 1,
 "name": "Deutschland",
 "nametwo": "Germany",
 "language": "german",
 "short": "de",
 "taxid": "2",
 "active": "1"
}

This endpoint retrieves a specific country.

HTTP Request

GET http://example.com/api/v2/country/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the country to retrieve.

Reply

Parameter Type Description
id number Unique ID
name string Unique name of the country in the primary language.
nametwo string Unique name of the country in the second language.
language string Name of the language file without file extension.
short string Two-digit country code. (e.g. uk)
taxid number Unique tax ID from teklab_finance_taxkeys => id.
active number Specifies whether the country can be used. (0 = deactivated, 1 = activated)

Add a country

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/country');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'name' => 'Schweden',
  'nametwo' => 'Sweden',
  'language' => 'swedish',
  'short' => 'se',
  'taxid' => '8',
  'active' => '1'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/country" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "name": "Schweden",
    "nametwo": "Sweden",
    "language": "swedish",
    "short": "se",
    "taxid": "8",
    "active": "1"
  }'

The above command returns JSON structured like this:

{
  "id": "29",
  "message": "SUCCESSFUL"
}

Create a new country in your TekBASE. For each country there can be only one "name" and "nametwo" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/country

Request

Parameter Type Description
name string¹ Unique name of the country in the primary language.
nametwo string Unique name of the country in the second language.
language string¹ Name of the language file without file extension.
short string¹ Two-digit country code. (e.g. uk)
taxid number Unique tax ID from teklab_finance_taxkeys => id.
active number Specifies whether the country can be used. (0 = deactivated, 1 = activated)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a country

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/country/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'language' => 'german',
  'active' => '0'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/country/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "language": "german",
    "active": "0",
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a country in your TekBASE. For each country there can be only one "name" and "nametwo" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/country/{id}

Request

Parameter Type Description
name string¹ Unique name of the country in the primary language.
nametwo string Unique name of the country in the second language.
language string¹ Name of the language file without file extension.
short string¹ Two-digit country code. (e.g. uk)
taxid number Unique tax ID from teklab_finance_taxkeys => id.
active number Specifies whether the country can be used. (0 = deactivated, 1 = activated)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a country

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/country/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/country/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific country.

HTTP Request

DELETE http://example.com/api/v2/country/{id}

Request

Parameter Type Description
id number¹ The ID of the country to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Databases

These are the databases that are installed on the server and assigned to a customer.

Get all databases

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/database?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/database" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "memberid": "1",
    "productid": "4",
    "serverip": "123.123.123.123",
    "name": "db_3443",
    "login": "dbuser_a",
    "rserverid": "1",
    "softlimit": ""
  },
  {
    "id": 2,
    "memberid": "2",
    "productid": "7",
    "serverip": "123.123.123.123",
    "name": "db_7536",
    "login": "dbuser_b",
    "rserverid": "1",
    "softlimit": ""
  }
]

Returns all existing database objects.

HTTP Request

GET http://example.com/api/v2/database

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY memberid ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. memberid)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
memberid number Unique member ID from teklab_members => id.
productid number Unique product ID from teklab_members_product => id.
serverip string The IP address of the server where the application was installed.
name string Unique name of the database per root server.
login string Unique database login name per root server.
rserverid number Unique ID of the root server from teklab_rootserver => id.
softlimit string Not yet implemented. Limits the disk space for the database. (e.g. 500M or 1G ...)

Get a database

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/database/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/database/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
 "id": 1,
 "memberid": "1",
 "productid": "4",
 "serverip": "123.123.123.123",
 "name": "db_3443",
 "login": "dbuser_a",
 "rserverid": "1",
 "softlimit": ""
}

This endpoint retrieves a specific database.

HTTP Request

GET http://example.com/api/v2/database/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the database to retrieve.

Reply

Parameter Type Description
id number Unique ID
memberid number Unique member ID from teklab_members => id.
productid number Unique product ID from teklab_members_product => id.
serverip string The IP address of the server where the application was installed.
name string Unique name of the database per root server.
login string Unique database login name per root server.
rserverid number Unique ID of the root server from teklab_rootserver => id.
softlimit string Not yet implemented. Limits the disk space for the database. (e.g. 500M or 1G ...)

Add a database

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/database');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'memberid' => '1',
  'productid' => '5',
  'serverip' => '123.123.123.123',
  'name' => 'db_8352',
  'login' => 'dbuser_b',
  'rserverid' => '1',
  'softlimit' => ''
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/database" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "memberid": "1",
    "productid": "5",
    "serverip": "123.123.123.123",
    "name": "db_8352",
    "login": "dbuser_b",
    "rserverid": "1",
    "softlimit": ""
  }'

The above command returns JSON structured like this:

{
  "id": "7",
  "message": "SUCCESSFUL"
}

Create a new database in your TekBASE. For each database there can be only one combination of the parameters "serverip" and "name". No duplicate entries.

HTTP Request

POST http://example.com/api/v2/database

Request

Parameter Type Description
memberid number¹ Unique member ID from teklab_members => id.
productid number Unique product ID from teklab_members_product => id.
serverip string¹ The IP address of the server where the application was installed.
name string¹ Unique name of the database per root server.
login string¹ Unique database login name per root server.
rserverid number¹ Unique ID of the root server from teklab_rootserver => id.
softlimit string Not yet implemented. Limits the disk space for the database. (e.g. 500M or 1G ...)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a database

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/database/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'productid' => '4',
  'serverip' => '123.123.123.124',
  'name' => 'db_5433'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/database/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "productid": "4",
    "serverip": "123.123.123.124",
    "name": "db_5433"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a database in your TekBASE. For each database there can be only one combination of the parameters "serverip" and "name". No duplicate entries.

HTTP Request

POST http://example.com/api/v2/database/{id}

Request

Parameter Type Description
productid number Unique product ID from teklab_members_product => id.
serverip string¹ The IP address of the server where the application was installed.
name string² Unique name of the database per root server.
softlimit string Not yet implemented. Limits the disk space for the database. (e.g. 500M or 1G ...)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a database

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/database/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/database/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific database.

HTTP Request

DELETE http://example.com/api/v2/database/{id}

Request

Parameter Type Description
id number¹ The ID of the database to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Email accounts

These email accounts are used for sending login data, invoices, order confirmations, etc.

Get all email accounts

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/emailaccount?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/emailaccount" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "email": "bill@test.com",
    "emailtwo": "admin@test.com",
    "email_bill": "1",
    "email_cms": "0",
    "email_newsletter": "0",
    "email_shop": "0",
    "email_system": "0",
    "email_type": "1",
    "name": "Test - Billing Team",
    "shost": "email-smtp.eu-west-1.amazonaws.com",
    "sport": "465",
    "suser": "AIEBSHDS2KEHU7WDHW4D",
    "spasswd": "AchAu3bc783bF/bhjH2bB+Dn37dnHQpNC",
    "sauth": "1",
    "secure": "2",
    "signature": ""   
  },
  {
    "id": 2,
    "email": "no-reply@test.com",
    "emailtwo": "admin@test.com",
    "email_bill": "0",
    "email_cms": "0",
    "email_newsletter": "1",
    "email_shop": "0",
    "email_system": "1",
    "email_type": "1",
    "name": "Test - Service Team",
    "shost": "email-smtp.eu-west-1.amazonaws.com",
    "sport": "465",
    "suser": "AI32SXHK7LEI32WDABE3",
    "spasswd": "AiFwI34oe3/foe34Nw+DnSs3OnMQSxW9G",
    "sauth": "1",
    "secure": "2",
    "signature": ""  
  }
]

Returns all existing email account objects.

HTTP Request

GET http://example.com/api/v2/emailaccount

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY email ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. email)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
email string Unique email address for sending emails.
emailtwo string Email address for a copy of the message.
email_bill number Use email to send invoices and reminders. (0 = no, 1 = yes)
email_cms number Use email to send CMS requests, such as contact and login data. (0 = no, 1 = yes)
email_newsletter number Use email to send newsletters. (0 = no, 1 = yes)
email_shop number Use email to send order confirmations. (0 = no, 1 = yes)
email_system number Use email to send general emails from the admin/customer panel. (0 = no, 1 = yes)
email_type number Sending email with PHP Mail or SMTP. (0 = PHP Mail, 1 = SMTP)
name string Name of the sender.
shost string IP or domain of the SMTP server.
sport number Port of the SMTP server.
suser string Username for the email account.
spasswd string Password for the email account.
sauth number SMTP connection with or without authentication. (0 = no, 1 = yes)
secure number Select the connection Encryption. (0 = none, 1 = TLS, 2 = SSL)
signature text The signature is added to each text email.

Get an email account

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/emailaccount/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/emailaccount/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
 "id": 1,
 "email": "bill@test.com",
 "emailtwo": "admin@test.com",
 "email_bill": "1",
 "email_cms": "0",
 "email_newsletter": "0",
 "email_shop": "0",
 "email_system": "0",
 "email_type": "1",
 "name": "Test - Billing Team",
 "shost": "email-smtp.eu-west-1.amazonaws.com",
 "sport": "465",
 "suser": "AIEBSHDS2KEHU7WDHW4D",
 "spasswd": "AchAu3bc783bF/bhjH2bB+Dn37dnHQpNC",
 "sauth": "1",
 "secure": "2",
 "signature": ""  
}

This endpoint retrieves a specific email account.

HTTP Request

GET http://example.com/api/v2/emailaccount/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the email account to retrieve.

Reply

Parameter Type Description
id number Unique ID
email string Unique email address for sending emails.
emailtwo string Email address for a copy of the message.
email_bill number Use email to send invoices and reminders. (0 = no, 1 = yes)
email_cms number Use email to send CMS requests, such as contact and login data. (0 = no, 1 = yes)
email_newsletter number Use email to send newsletters. (0 = no, 1 = yes)
email_shop number Use email to send order confirmations. (0 = no, 1 = yes)
email_system number Use email to send general emails from the admin/customer panel. (0 = no, 1 = yes)
email_type number Sending email with PHP Mail or SMTP. (0 = PHP Mail, 1 = SMTP)
name string Name of the sender.
shost string IP or domain of the SMTP server.
sport number Port of the SMTP server.
suser string Username for the email account.
spasswd string Password for the email account.
sauth number SMTP connection with or without authentication.
secure number Select the connection Encryption. (0 = none, 1 = TLS, 2 = SSL)
signature text The signature is added to each text email.

Add an email account

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/emailaccount');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'email' => 'service@test.com',
  'emailtwo' => 'admin@test.com',
  'email_bill' => '0',
  'email_cms' => '0',
  'email_newsletter' => '0',
  'email_shop' => '0',
  'email_system' => '1',
  'email_type' => '1',
  'name' => 'Test - System Mail',
  'shost' => 'email-smtp.eu-west-1.amazonaws.com',
  'sport' => '465',
  'suser' => 'AIDB3BDSZ8EOP7WDJI2E',
  'spasswd' => 'Aeh4Dw79b/mKLdWu7p+4v2bFn37dnHGT4',
  'sauth' => '1',
  'secure' => '2',
  'signature' => ''               
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/emailaccount" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "email": "service@test.com",
    "emailtwo": "admin@test.com",
    "email_bill": "0",
    "email_cms": "0",
    "email_newsletter": "0",
    "email_shop": "0",
    "email_system": "1",
    "email_type": "1",
    "name": "Test - System Mail",
    "shost": "email-smtp.eu-west-1.amazonaws.com",
    "sport": "465",
    "suser": "AIDB3BDSZ8EOP7WDJI2E",
    "spasswd": "Aeh4Dw79b/mKLdWu7p+4v2bFn37dnHGT4",
    "sauth": "1",
    "secure": "2",
    "signature": ""
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new email account in your TekBASE. For each account there can be only one "email" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/emailaccount

Request

Parameter Type Description
email string¹ Unique email address for sending emails.
emailtwo string Email address for a copy of the message.
email_bill number Use email to send invoices and reminders. (0 = no, 1 = yes)
email_cms number Use email to send CMS requests, such as contact and login data. (0 = no, 1 = yes)
email_newsletter number Use email to send newsletters. (0 = no, 1 = yes)
email_shop number Use email to send order confirmations. (0 = no, 1 = yes)
email_system number Use email to send general emails from the admin/customer panel. (0 = no, 1 = yes)
email_type number Sending email with PHP Mail or SMTP. (0 = PHP Mail, 1 = SMTP)
name string¹ Name of the sender.
shost string IP or domain of the SMTP server.
sport number Port of the SMTP server.
suser string Username for the email account.
spasswd string Password for the email account.
sauth number SMTP connection with or without authentication.
secure number Select the connection Encryption. (0 = none, 1 = TLS, 2 = SSL)
signature text The signature is added to each text email.

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update an email account

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/emailaccount/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'email' => 'accounting@test.com',
  'name' => 'Test - Accounting Mail'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/emailaccount/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "email": "accounting@test.com",
    "name": "Test - Accounting Mail"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update an email account in your TekBASE. For each email account there can be only one "email" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/emailaccount/{id}

Request

Parameter Type Description
email string¹ Unique email address for sending emails.
emailtwo string Email address for a copy of the message.
email_bill number Use email to send invoices and reminders. (0 = no, 1 = yes)
email_cms number Use email to send CMS requests, such as contact and login data. (0 = no, 1 = yes)
email_newsletter number Use email to send newsletters. (0 = no, 1 = yes)
email_shop number Use email to send order confirmations. (0 = no, 1 = yes)
email_system number Use email to send general emails from the admin/customer panel. (0 = no, 1 = yes)
email_type number Sending email with PHP Mail or SMTP. (0 = PHP Mail, 1 = SMTP)
name string¹ Name of the sender.
shost string IP or domain of the SMTP server.
sport number Port of the SMTP server.
suser string Username for the email account.
spasswd string Password for the email account.
sauth number SMTP connection with or without authentication.
secure number Select the connection Encryption. (0 = none, 1 = TLS, 2 = SSL)
signature text The signature is added to each text email.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete an email account

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/emailaccount/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/emailaccount/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific email account.

HTTP Request

DELETE http://example.com/api/v2/emailaccount/{id}

Request

Parameter Type Description
id number¹ The ID of the email account to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - accounts

The financial accounts are used for posting in the business transactions.

Get all accounts

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/account?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/account" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "sign": "General revenue",
    "text": ""   
  },
  {
    "id": 2,
    "sign": "General expenditure",
    "text": ""   
  }
]

Returns all existing account objects.

HTTP Request

GET http://example.com/api/v2/finance/account

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY sign ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. sign)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
sign string Unique account identification for postings in business transactions.
text text Account description or note.

Get an account

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/account/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/account/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
 "id": 1,
 "sign": "General revenue",
 "text": "" 
}

This endpoint retrieves a specific account.

HTTP Request

GET http://example.com/api/v2/finance/account/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the account to retrieve.

Reply

Parameter Type Description
id number Unique ID
sign string Unique account identification for postings in business transactions.
text text Account description or note.

Add an account

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/account');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'sign' => 'Revenue invoices',
  'text' => ''              
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/account" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "sign": "Revenue invoices",
    "text": ""
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new account in your TekBASE. For each account there can be only one "sign" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/account

Request

Parameter Type Description
sign string¹ Unique account identification for postings in business transactions.
text text Account description or note.

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update an account

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/account/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'sign' => 'Advertising expenses',
  'text' => ''
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/account/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "sign": "Advertising expenses",
    "text": ""
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update an account in your TekBASE. For each account there can be only one "sign" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/account/{id}

Request

Parameter Type Description
sign string¹ Unique account identification for postings in business transactions.
text text Account description or note.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete an account

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/account/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/account/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific account.

HTTP Request

DELETE http://example.com/api/v2/finance/account/{id}

Request

Parameter Type Description
id number¹ The ID of the account to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - contracts

Contracts can be linked to customer packages. Customers can print the deposited contracts as PDF files.

Get all contracts

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/contract?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/contract" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "title": "Rental agreement for servers",
    "text": "html formated text"   
  },
  {
    "id": 2,
    "sign": "General contract",
    "text": "html formated text"   
  }
]

Returns all existing contract objects.

HTTP Request

GET http://example.com/api/v2/finance/contract

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY title ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. title)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
title string Unique contract identification.
text text HTML formated text.

Get a contract

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/contract/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/contract/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
 "id": 1,
 "title": "Rental agreement for servers",
 "text": "" 
}

This endpoint retrieves a specific contract.

HTTP Request

GET http://example.com/api/v2/finance/contract/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the contract to retrieve.

Reply

Parameter Type Description
id number Unique ID
title string Unique contract identification.
text text HTML formated text.

Add a contract

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/contract');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'title' => 'Test contract',
  'text' => 'Test <b>contract</b>'              
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/contract" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "title": "Test contract",
    "text": "Test <b>contract</b>"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new contract in your TekBASE. For each contract there can be only one "title" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/contract

Request

Parameter Type Description
title string¹ Unique contract identification.
text text HTML formated text.

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a contract

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/contract/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'title' => 'Rental agreement for webspace',
  'text' => 'Test'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/contract/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "sign": "Rental agreement for webspace",
    "text": "Test"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a contract in your TekBASE. For each contract there can be only one "title" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/contract/{id}

Request

Parameter Type Description
title string¹ Unique contract identification.
text text HTML formated text.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a contract

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/contract/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/contract/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific contract.

HTTP Request

DELETE http://example.com/api/v2/finance/contract/{id}

Request

Parameter Type Description
id number¹ The ID of the contract to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - debtors

Customers with open items can be added to the debtor list.

Get all debtors

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/debtor?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/debtor" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "memberid": "1",
    "typ": "1",
    "member": "cu100001",
    "email": "johndoe@email.com",
    "title": "0",
    "firm": "",
    "forename": "John",
    "surname": "Doe",
    "birthday": "1979-01-01",
    "street": "123 N Main Street",
    "city": "Los Angeles",
    "zipcode": "CA 90012",
    "country": "30",
    "phone": "+555 555 555 00",
    "refid": "REF20192341-2",
    "billid": "IN11900123",
    "date": "2019-01-01",
    "rdate": "2019-02-01",
    "debts": "350.00",
    "fines": "25.00",
    "info": "",
    "senddate": "2019-02-07",
    "status": "0"
  },
  {
    "id": 2,
    "memberid": "2",
    "typ": "1",
    "member": "cu1000202",
    "email": "janedoe@email.com",
    "title": "0",
    "firm": "",
    "forename": "Jane",
    "surname": "Doe",
    "birthday": "1985-01-01",
    "street": "148 N Main Street",
    "city": "Los Angeles",
    "zipcode": "CA 90012",
    "country": "30",
    "phone": "+555 555 555 01",
    "refid": "REF20192712-1",
    "billid": "IN11900126",
    "date": "2019-01-02",
    "rdate": "2019-02-02",
    "debts": "43.00",
    "fines": "5.00",
    "info": "",
    "senddate": "2019-02-08",
    "status": "0"
  }
]

Returns all existing debtor objects.

HTTP Request

GET http://example.com/api/v2/finance/contract

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY city ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. city)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
memberid number Unique member ID from teklab_members => id.
typ number Specifies whether the customer was added to the debtor database or transferred to a collection system. (0 = debtor db local, 1 = debtor db global, 2-5 = debt collection)
member string Debtor identification from teklab_members => member.
email string Debtor email from teklab_members => email.
title number Debtor gender/firm status from teklab_members => title. (0 = MR., 1 = MS., 2 = company)
firm string Debtor company name from teklab_members => firm.
forename string Debtor forename from teklab_members => forename.
surname string Debtor surname from teklab_members => surname.
birthday date Debtor surname from teklab_members => birthday. (e.g. 1979-01-31)
street string Debtor surname from teklab_members => street.
city string Debtor city from teklab_members => city.
zipcode string Debtor zipcode from teklab_members => zipcode.
country number Debtor surname from teklab_members => country / teklab_country => id
phone string Debtor phone from teklab_members => phone.
refid string Reference number of debt collection.
billid string Invoice number of the dunned amount.
date date Date of the dunned invoice.
rdate date Date of the last dunning notice.
debts decimal Invoice amount of the dunned invoice.
fines decimal Dunning charges and interest.
info text Space for notes on the process.
senddate date Date of transfer to the debtor database or debt collection.
status number Status of the debtor entry. (0 = local, 1 = transmitted, 2 = transmission error)

Get a debtor

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/debtor/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/debtor/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "memberid": "1",
  "typ": "1",
  "member": "cu100001",
  "email": "johndoe@email.com",
  "title": "0",
  "firm": "",
  "forename": "John",
  "surname": "Doe",
  "birthday": "1979-01-01",
  "street": "123 N Main Street",
  "city": "Los Angeles",
  "zipcode": "CA 90012",
  "country": "30",
  "phone": "+555 555 555 00",
  "refid": "REF20192341-2",
  "billid": "IN11900123",
  "date": "2019-01-01",
  "rdate": "2019-02-01",
  "debts": "350.00",
  "fines": "25.00",
  "info": "",
  "senddate": "2019-02-07",
  "status": "0"
}

This endpoint retrieves a specific debtor.

HTTP Request

GET http://example.com/api/v2/finance/debtor/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the debtor to retrieve.

Reply

Parameter Type Description
id number Unique ID
memberid number Unique member ID from teklab_members => id.
typ number Specifies whether the customer was added to the debtor database or transferred to a collection system. (0 = debtor db local, 1 = debtor db global, 2-5 = debt collection)
member string Debtor identification from teklab_members => member.
email string Debtor email from teklab_members => email.
title number Debtor gender/firm status from teklab_members => title. (0 = MR., 1 = MS., 2 = company)
firm string Debtor company name from teklab_members => firm.
forename string Debtor forename from teklab_members => forename.
surname string Debtor surname from teklab_members => surname.
birthday date Debtor surname from teklab_members => birthday. (e.g. 1979-01-31)
street string Debtor surname from teklab_members => street.
city string Debtor city from teklab_members => city.
zipcode string Debtor zipcode from teklab_members => zipcode.
country number Debtor surname from teklab_members => country / teklab_country => id
phone string Debtor phone from teklab_members => phone.
refid string Reference number of debt collection.
billid string Invoice number of the dunned amount.
date date Date of the dunned invoice.
rdate date Date of the last dunning notice.
debts decimal Invoice amount of the dunned invoice.
fines decimal Dunning charges and interest.
info text Space for notes on the process.
senddate date Date of transfer to the debtor database or debt collection.
status number Status of the debtor entry. (0 = local, 1 = transmitted, 2 = transmission error)

Add a debtor

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/debtor');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'memberid' => '1',
  'typ' => '1',
  'member' => 'cu100001',
  'email' => 'johndoe@email.com',
  'title' => '0',
  'firm' => '',
  'forename' => 'John',
  'surname' => 'Doe',
  'birthday' => '1979-01-01',
  'street' => '123 N Main Street',
  'city' => 'Los Angeles',
  'zipcode' => 'CA 90012',
  'country' => '30',
  'phone' => '+555 555 555 00',
  'refid' => 'REF20192841-1',
  'billid' => 'IN11900523',
  'date' => '2019-03-21',
  'rdate' => '2019-05-14',
  'debts' => '465.00',
  'fines' => '32.00',
  'info' => '',
  'senddate' => '2019-05-28',
  'status' => '0'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/debtor" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "memberid": "1",
    "typ": "1",
    "member": "cu100001",
    "email": "johndoe@email.com",
    "title": "0",
    "firm": "",
    "forename": "John",
    "surname": "Doe",
    "birthday": "1979-01-01",
    "street": "123 N Main Street",
    "city": "Los Angeles",
    "zipcode": "CA 90012",
    "country": "30",
    "phone": "+555 555 555 00",
    "refid": "REF20192341-2",
    "billid": "IN11900123",
    "date": "2019-01-01",
    "rdate": "2019-02-01",
    "debts": "350.00",
    "fines": "25.00",
    "info": "",
    "senddate": "2019-02-07",
    "status": "0"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new debtor in your TekBASE. For each debtor there can be only one "billid" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/debtor

Request

Parameter Type Description
memberid number¹ Unique member ID from teklab_members => id.
typ number² Specifies whether the customer was added to the debtor database or transferred to a collection system. (0 = debtor db local, 1 = debtor db global, 2-5 = debt collection)
member string¹ Debtor identification from teklab_members => member.
email string¹ Debtor email from teklab_members => email.
title number Debtor gender/firm status from teklab_members => title. (0 = MR., 1 = MS., 2 = company)
firm string Debtor company name from teklab_members => firm.
forename string¹ Debtor forename from teklab_members => forename.
surname string¹ Debtor surname from teklab_members => surname.
birthday date¹ Debtor surname from teklab_members => birthday. (e.g. 1979-01-31)
street string¹ Debtor surname from teklab_members => street.
city string¹ Debtor city from teklab_members => city.
zipcode string¹ Debtor zipcode from teklab_members => zipcode.
country number¹ Debtor surname from teklab_members => country / teklab_country => id
phone string Debtor phone from teklab_members => phone.
refid string² Reference number of debt collection.
billid string¹ Invoice number of the dunned amount.
date date¹ Date of the dunned invoice.
rdate date¹ Date of the last dunning notice.
debts decimal¹ Invoice amount of the dunned invoice.
fines decimal Dunning charges and interest.
info text Space for notes on the process.
status number Status of the debtor entry. (0 = local, 1 = transmitted, 2 = transmission error)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a debtor

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/debtor/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'street' => '127 N Main Street',
  'phone' => '+555 555 555 11'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/debtor/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "street": "127 N Main Street",
    "phone": "+555 555 555 11"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a debtor in your TekBASE. For each debtor there can be only one "billid" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/debtor/{id}

Request

Parameter Type Description
typ number² Specifies whether the customer was added to the debtor database or transferred to a collection system. (0 = debtor db local, 1 = debtor db global, 2-5 = debt collection)
member string¹ Debtor identification from teklab_members => member.
email string¹ Debtor email from teklab_members => email.
title number Debtor gender/firm status from teklab_members => title. (0 = MR., 1 = MS., 2 = company)
firm string Debtor company name from teklab_members => firm.
forename string¹ Debtor forename from teklab_members => forename.
surname string¹ Debtor surname from teklab_members => surname.
birthday date¹ Debtor surname from teklab_members => birthday. (e.g. 1979-01-31)
street string¹ Debtor surname from teklab_members => street.
city string¹ Debtor city from teklab_members => city.
zipcode string¹ Debtor zipcode from teklab_members => zipcode.
country number¹ Debtor surname from teklab_members => country / teklab_country => id
phone string Debtor phone from teklab_members => phone.
refid string² Reference number of debt collection.
billid string¹ Invoice number of the dunned amount.
date date¹ Date of the dunned invoice.
rdate date¹ Date of the last dunning notice.
debts decimal¹ Invoice amount of the dunned invoice.
fines decimal Dunning charges and interest.
info text Space for notes on the process.
status number Status of the debtor entry. (0 = local, 1 = transmitted, 2 = transmission error)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a debtor

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/debtor/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/debtor/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific debtor.

HTTP Request

DELETE http://example.com/api/v2/finance/debtor/{id}

Request

Parameter Type Description
id number¹ The ID of the debtor to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - open positions

Invoices that have not yet been paid are listed here. Open positions are also used for sending reminders.

Get all open positions

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/openposition?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/openposition" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "date": "1548775668",
    "rdate": "1550762868",
    "member": "cu100001",
    "receiptid": "IN11900123",
    "money": "350.00",
    "rdates": "1550244468\r\n1550762868",
    "dta": "0",
    "status": "2",
    "archive": "0"
  },
  {
    "id": 2,
    "date": "1548776678",
    "rdate": "1550253467",
    "member": "cu100002",
    "receiptid": "IN11900125",
    "money": "90.00",
    "rdates": "1550253467",
    "dta": "0",
    "status": "1",
    "archive": "1"
  }
]

Returns all existing open postion objects.

HTTP Request

GET http://example.com/api/v2/finance/openposition

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY status ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. status)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
date number Specifies the date of invoice.
rdate number Date of last reminder.
member string Customer identification from teklab_members => member.
receiptid string Unique invoice ID from teklab_finance_bill => billid.
money decimal Specifies the invoice amount.
rdates text Contains the send date of all reminders. (e.g. 1550244468\r\n1550762868 = date of two reminders)
dta number Indicates whether the DTA export has already taken place. (0 = no, 1 = yes)
status number Specification of the reminder level.
archive number Indicates whether the open item was paid and thus archived. (0 = open, 1 = closed)

Get an open position

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/openposition/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/openposition/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "date": "1548775668",
  "rdate": "1550762868",
  "member": "cu100001",
  "receiptid": "IN11900123",
  "money": "350.00",
  "rdates": "1550244468\r\n1550762868",
  "dta": "0",
  "status": "2",
  "archive": "0"
}

This endpoint retrieves a specific open position.

HTTP Request

GET http://example.com/api/v2/finance/openposition/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the open position to retrieve.

Reply

Parameter Type Description
id number Unique ID
date number Specifies the date of invoice.
rdate number Date of last reminder.
member string Customer identification from teklab_members => member.
receiptid string Unique invoice ID from teklab_finance_bill => billid.
money decimal Specifies the invoice amount.
rdates text Contains the send date of all reminders. (e.g. 1550244468\r\n1550762868 = date of two reminders)
dta number Indicates whether the DTA export has already taken place. (0 = no, 1 = yes)
status number Specification of the reminder level.
archive number Indicates whether the open item was paid and thus archived. (0 = open, 1 = closed)

Add an open position

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/openposition');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'date' => '1548784326',
  'rdate' => '1550257165',
  'member' => 'cu100001',
  'receiptid' => 'IN11900126',
  'money' => '34.00',
  'rdates' => '1550257165',
  'dta' => '0',
  'status' => '0'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/openposition" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "date": "1548784326",
    "rdate": "1550257165",
    "member": "cu100001",
    "receiptid": "IN11900126",
    "money": "34.00",
    "rdates": "1550257165",
    "dta": "0",
    "status": "2"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new open position in your TekBASE. For each open position there can be only one "receiptid" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/openposition

Request

Parameter Type Description
date¹ number Specifies the date of invoice.
rdate number Date of last reminder.
member¹ string Customer identification from teklab_members => member.
receiptid¹ string Unique invoice ID from teklab_finance_bill => billid.
money¹ decimal Specifies the invoice amount.
rdates text Contains the send date of all reminders. (e.g. 1550244468\r\n1550762868 = date of two reminders)
dta number Indicates whether the DTA export has already taken place. (0 = no, 1 = yes)
status number Specification of the reminder level.

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update an open position

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/openposition/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'rdate' => '1550774268',
  'status' => '1',
  'rdates' => '1550774268'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/openposition/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "rdate": "1550774268",
    "status": "1",
    "rdates": "1550774268"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update an open position in your TekBASE. For each open position there can be only one "receiptid" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/openposition/{id}

Request

Parameter Type Description
date¹ number Specifies the date of invoice.
rdate number Date of last reminder.
member¹ string Customer identification from teklab_members => member.
receiptid¹ string Unique invoice ID from teklab_finance_bill => billid.
money¹ decimal Specifies the invoice amount.
rdates text Contains the send date of all reminders. (e.g. 1550244468\r\n1550762868 = date of two reminders)
dta number Indicates whether the DTA export has already taken place. (0 = no, 1 = yes)
status number Specification of the reminder level.
archive number Indicates whether the open item was paid and thus archived. (0 = open, 1 = closed)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a open position

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/openposition/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/openposition/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific open position.

HTTP Request

DELETE http://example.com/api/v2/finance/openposition/{id}

Request

Parameter Type Description
id number¹ The ID of the open position to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - products

These products are used to create credit deposit invoices, dunning costs invoices and customer packages. A customer package is a collection of products for billing.

Get all products

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/product?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/product" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "number": "100001",
    "title": "Game server CSGO-16S",
    "text": "Game server CSGO - 16Slot",
    "price": "10.00",
    "tax": "2",
    "accountid": "3",
    "conid": "1",
    "typ": "0"
  },
  {
    "id": 2,
    "number": "100002",
    "title": "Credit Deposit",
    "text": "Credit Deposit",
    "price": "10.00",
    "tax": "2",
    "accountid": "3",
    "conid": "0",
    "typ": "3"
  }
]

Returns all existing product objects.

HTTP Request

GET http://example.com/api/v2/finance/product

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY typ ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. typ)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
number string Unique article number ID (e.g. 100001 or P100001)
title string Unique product title.
text text The text serves only as a placeholder/template and is inserted into the invoice as a product. But the text can be customized in the customer package.
price decimal The text only serves as a placeholder/template.
tax number Unique tax ID from teklab_finance_taxkeys => id.
accountid number Unique account ID from teklab_finance_accounts => id.
conid number Unique contract ID from teklab_finance_contracts => id.
typ number Specifies what the product is used for. (0 = customer package, 1 = reminder fee, 2 = shop order, 3 = credit deposit)

Get a product

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/product/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/product/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "number": "100001",
  "title": "Game server CSGO-16S",
  "text": "Game server CSGO - 16Slot",
  "price": "10.00",
  "tax": "2",
  "accountid": "3",
  "conid": "1",
  "typ": "0"
}

This endpoint retrieves a specific product.

HTTP Request

GET http://example.com/api/v2/finance/product/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the product to retrieve.

Reply

Parameter Type Description
id number Unique ID
number string Unique article number ID (e.g. 100001 or P100001)
title string Unique product title.
text text The text serves only as a placeholder/template and is inserted into the invoice as a product. But the text can be customized in the customer package.
price decimal The text only serves as a placeholder/template.
tax number Unique tax ID from teklab_finance_taxkeys => id.
accountid number Unique account ID from teklab_finance_accounts => id.
conid number Unique contract ID from teklab_finance_contracts => id.
typ number Specifies what the product is used for. (0 = customer package, 1 = reminder fee, 2 = shop order, 3 = credit deposit)

Add a product

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/product');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'number' => '100003',
  'title' => 'Virtual Server XS',
  'text' => 'Virtual Server XS',
  'price' => '4.99',
  'tax' => '2',
  'accountid' => '3',
  'conid' => '2',
  'typ' => '1'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/product" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "number": "100003",
    "title": "Virtual Server XS",
    "text": "Virtual Server XS",
    "price": "4.99",
    "tax": "2",
    "accountid": "3",
    "conid": "2",
    "typ": "1"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new product in your TekBASE. For each product there can be only one "number" and "title" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/product

Request

Parameter Type Description
number string¹ Unique article number ID (e.g. 100001 or P100001)
title string¹ Unique product title.
text text¹ The text serves only as a placeholder/template and is inserted into the invoice as a product. But the text can be customized in the customer package.
price decimal¹ The text only serves as a placeholder/template.
tax number¹ Unique tax ID from teklab_finance_taxkeys => id.
accountid number² Unique account ID from teklab_finance_accounts => id.
conid number Unique contract ID from teklab_finance_contracts => id.
typ number Specifies what the product is used for. (0 = customer package, 1 = reminder fee, 2 = shop order, 3 = credit deposit)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a product

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/product/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'title' => 'Game server CSGO-12S',
  'text' => 'Game server CSGO 12 Slot',
  'price' => '7.99'       
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/product/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "title": "Game server CSGO-12S",
    "text": "Game server CSGO 12 Slot",
    "price": "7.99"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a product in your TekBASE. For each product there can be only one "number" and "title" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/product/{id}

Request

Parameter Type Description
number string¹ Unique article number ID (e.g. 100001 or P100001)
title string¹ Unique product title.
text text¹ The text serves only as a placeholder/template and is inserted into the invoice as a product. But the text can be customized in the customer package.
price decimal¹ The text only serves as a placeholder/template.
tax number¹ Unique tax ID from teklab_finance_taxkeys => id.
accountid number² Unique account ID from teklab_finance_accounts => id.
conid number Unique contract ID from teklab_finance_contracts => id.
typ number Specifies what the product is used for. (0 = customer package, 1 = reminder fee, 2 = shop order, 3 = credit deposit)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a product

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/product/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/product/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific product.

HTTP Request

DELETE http://example.com/api/v2/finance/product/{id}

Request

Parameter Type Description
id number¹ The ID of the product to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - reminder

Manage dunning levels and dunning fees in percent or fixed price. Sending reminders to customers.

Get all reminders

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/reminder?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/reminder" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "step": "1",
    "days": "14",
    "interest": "0",
    "price": "0"
  },
  {
    "id": 2,
    "step": "2",
    "days": "7",
    "interest": "5",
    "price": "10"
  }
]

Returns all existing reminder objects.

HTTP Request

GET http://example.com/api/v2/finance/reminder

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY step ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. step)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
step number Unique reminder level.
days number To be used according to the number of days indicated since the last reminder.
interest decimal Interest on the open invoice amount. (e.g. 5.00)
price decimal Fixed price for the respective reminder level. (e.g. 10.00)

Get a reminder

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/reminder/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/reminder/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "step": "1",
  "days": "14",
  "interest": "0",
  "price": "0"
}

This endpoint retrieves a specific reminder.

HTTP Request

GET http://example.com/api/v2/finance/reminder/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the reminder to retrieve.

Reply

Parameter Type Description
id number Unique ID
step number Unique reminder level.
days number To be used according to the number of days indicated since the last reminder.
interest decimal Interest on the open invoice amount. (e.g. 5.00)
price decimal Fixed price for the respective reminder level. (e.g. 10.00)

Add a reminder

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/reminder');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'step' => '3',
  'days' => '7',
  'interest' => '5',
  'price' => '40.00'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/reminder" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "step": "3",
    "days": "7",
    "interest": "5",
    "price": "40.00"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new reminder in your TekBASE. For each reminder there can be only one "step" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/reminder

Request

Parameter Type Description
step number¹ Unique reminder level.
days number¹ To be used according to the number of days indicated since the last reminder.
interest decimal Interest on the open invoice amount. (e.g. 5.00)
price decimal Fixed price for the respective reminder level. (e.g. 10.00)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a reminder

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/reminder/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'days' => '28',
  'interest' => '5.00'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/reminder/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "days": "28",
    "interest": "5.00"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a reminder in your TekBASE. For each reminder there can be only one "step" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/reminder/{id}

Request

Parameter Type Description
step number¹ Unique reminder level.
days number¹ To be used according to the number of days indicated since the last reminder.
interest decimal Interest on the open invoice amount. (e.g. 5.00)
price decimal Fixed price for the respective reminder level. (e.g. 10.00)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a reminder

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/reminder/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/reminder/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific reminder.

HTTP Request

DELETE http://example.com/api/v2/finance/reminder/{id}

Request

Parameter Type Description
id number¹ The ID of the reminder to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - tax keys

Manage tax keys for countries and products.

Get all tax keys

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/taxkey?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/taxkey" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "tax": "0",
    "name": "VAT free"
  },
  {
    "id": 2,
    "tax": "19",
    "name": "VAT 19% (Germany)"
  }
]

Returns all existing tax key objects.

HTTP Request

GET http://example.com/api/v2/finance/taxkey

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY tax ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. tax)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
tax number Tax rate without percentage.
name string Unique name of the entry for easier administration.

Get a tax key

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/taxkey/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/taxkey/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "tax": "0",
  "name": "VAT free"
}

This endpoint retrieves a specific tax key.

HTTP Request

GET http://example.com/api/v2/finance/taxkey/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the reminder to retrieve.

Reply

Parameter Type Description
id number Unique ID
tax number Tax rate without percentage.
name string Unique name of the entry for easier administration.

Add a tax key

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/taxkey');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'tax' => '20',
  'name' => 'VAT 20% Austria'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/taxkey" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "tax": "20",
    "name": "VAT 20% Austria"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new tax key in your TekBASE. For each tax key there can be only one "name" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/taxkey

Request

Parameter Type Description
tax number¹ Tax rate without percentage.
name string¹ Unique name of the entry for easier administration.

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a tax key

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/taxkey/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'tax' => '20',
  'name' => 'United Kingdom'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/taxkey/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "tax": "20",
    "name": "United Kingdom"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a tax key in your TekBASE. For each tax key there can be only one "name" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/taxkey/{id}

Request

Parameter Type Description
tax number¹ Tax rate without percentage.
name string¹ Unique name of the entry for easier administration.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a tax key

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/taxkey/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/taxkey/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific tax key.

HTTP Request

DELETE http://example.com/api/v2/finance/taxkey/{id}

Request

Parameter Type Description
id number¹ The ID of the tax key to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Finance - transactions

Management of revenue and expenditure. Once all bookings for the month have been made, the month must be closed/archived.

Get all transactions

<?php
$json_array = [];

/* optimized request
$json_array = [
  'db' => [
    'limit' => '10',
    'orderby' => 'id',
    'sort' => 'ASC'
  ]
];
*/

$string = json_encode($json_array);
$string = urlencode($string);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/transaction?json='.$string);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/transaction" \
  -H 'authenticate: apikey=<API-Key>' \
  --data-urlencode 'json={}'

# optimized request
#  --data-urlencode 'json={"db":{"limit":"10","orderby":"id","sort":"ASC"}}'

The above command returns JSON structured like this:

[
  {
    "id": 1,
    "receiptid": "IN11900123",
    "accountid": "3",
    "taxkeyid": "1",
    "sign": "Invoice - IN11900123",
    "day": "28",
    "month": "01",
    "year": "2019",
    "moneyin": "350.00",
    "moneyout": "0.00",
    "canceled": "0",
    "periodsid": "1"
  },
  {
    "id": 2,
    "receiptid": "IN11900124",
    "accountid": "3",
    "taxkeyid": "1",
    "sign": "Invoice - IN11900124",
    "day": "29",
    "month": "01",
    "year": "2019",
    "moneyin": "25.85",
    "moneyout": "0.00",
    "canceled": "0",
    "periodsid": "1"
  }
]

Returns all existing transaction objects.

HTTP Request

GET http://example.com/api/v2/finance/transaction

Request

The db key in the request contains an array of database request optimizations, similar to ORDER BY periodsid ASC LIMIT 0, 10 with this structure:

Parameter Type Description
limit string¹ Limits the number of rows that are retrieved when a query is executed. (e.g. 10 or 0, 10)
orderby string¹ Sort the result based on some column. (e.g. periodsid)
sort string¹ Sort the result in ascending or descending order based on some column. (e.g. ASC or DESC)

Reply

Parameter Type Description
id number Unique ID
receiptid string Unique transaction ID (e.g. IN11900123 = invoice, AP1190001 = account posting)
accountid number Unique account ID from teklab_finance_accounts => id.
taxkeyid number Unique tax ID from teklab_finance_taxkeys => id.
sign string Short posting information. (e.g. Invoice - IN11900123or Private withdrawals ...)
day number Specifies the day of the booking.
month number Specifies the month of the booking.
year number Specifies the year of the booking.
moneyin decimal Amount of the debit entry. (e.g. 12.00 or -5.00)
moneyout decimal Amount of credit entry. (e.g. 12.00 or -5.00)
canceled number Specifies whether the posting was canceled. (0 = no, 1 = yes, )
periodsid number Specifies the accounting month to which the posting is assigned from teklab_finance_periods => id. (0 = current month and open for editing)

Get a transaction

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/transaction/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl "<TekBase-URL>/api/v2/finance/transaction/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "id": 1,
  "receiptid": "IN11900123",
  "accountid": "3",
  "taxkeyid": "1",
  "sign": "Invoice - IN11900123",
  "day": "28",
  "month": "01",
  "year": "2019",
  "moneyin": "350.00",
  "moneyout": "0.00",
  "canceled": "0",
  "periodsid": "1"
}

This endpoint retrieves a specific transaction.

HTTP Request

GET http://example.com/api/v2/finance/transaction/{id}

URI Parameters

Parameter Type Description
id number¹ The ID of the transaction to retrieve.

Reply

Parameter Type Description
id number Unique ID
receiptid string Unique transaction ID (e.g. IN11900123 = invoice, AP1190001 = account posting)
accountid number Unique account ID from teklab_finance_accounts => id.
taxkeyid number Unique tax ID from teklab_finance_taxkeys => id.
sign string Short posting information. (e.g. Invoice - IN11900123or Private withdrawals ...)
day number Specifies the day of the booking.
month number Specifies the month of the booking.
year number Specifies the year of the booking.
moneyin decimal Amount of the debit entry. (e.g. 12.00 or -5.00)
moneyout decimal Amount of credit entry. (e.g. 12.00 or -5.00)
canceled number Specifies whether the posting was canceled. (0 = no, 1 = yes, )
periodsid number Specifies the accounting month to which the posting is assigned from teklab_finance_periods => id. (0 = current month and open for editing)

Add a transaction

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/transaction');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'receiptid' => 'IN11900125',
  'accountid' => '3',
  'taxkeyid' => '1',
  'sign' => 'Invoice - IN11900125',
  'day' => '30',
  'month' => '01',
  'year' => '2019',
  'moneyin' => '90.00',
  'moneyout' => '0.00'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "POST" "<TekBase-URL>/api/v2/finance/transaction" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "receiptid": "IN11900125",
    "accountid": "3",
    "taxkeyid": "1",
    "sign": "Invoice - IN11900125",
    "day": "30",
    "month": "01",
    "year": "2019",
    "moneyin": "90.00",
    "moneyout": "0.00"
  }'

The above command returns JSON structured like this:

{
  "id": "3",
  "message": "SUCCESSFUL"
}

Create a new transaction in your TekBASE. For each transaction there can be only one "receiptid" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/transaction

Request

Parameter Type Description
receiptid string¹ Unique transaction ID (e.g. IN11900123 = invoice, AP1190001 = account posting)
accountid number¹ Unique account ID from teklab_finance_accounts => id.
taxkeyid number¹ Unique tax ID from teklab_finance_taxkeys => id.
sign string¹ Short posting information. (e.g. Invoice - IN11900123or Private withdrawals ...)
day number¹² Specifies the day of the booking.
month number¹² Specifies the month of the booking.
year number¹² Specifies the year of the booking.
moneyin decimal¹³ Amount of the debit entry. (e.g. 12.00 or -5.00)
moneyout decimal¹³ Amount of credit entry. (e.g. 12.00 or -5.00)

Reply

Parameter Type Description
id number Unique ID
message string Message with "SUCCESSFUL" text.

Update a transaction

<?php 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/transaction/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
  'Content-Type: application/json; charset=utf-8',
]);

$json_array = [
  'day' => '25',
  'moneyin' => '340.00',
  'moneyout' => '0.00'
]; 

$body = json_encode($json_array);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "PUT" "<TekBase-URL>/api/v2/finance/transaction/1" \
  -H 'authenticate: apikey=<API-Key>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d $'{
    "day": "25",
    "moneyin": "340.00",
    "moneyout": "0.00"
  }'

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

Update a transaction in your TekBASE that has not yet been archived or cancelled. For each transaction there can be only one "receiptid" parameter. No duplicate entries.

HTTP Request

POST http://example.com/api/v2/finance/transaction/{id}

Request

Parameter Type Description
receiptid string¹ Unique transaction ID (e.g. IN11900123 = invoice, AP1190001 = account posting)
accountid number¹ Unique account ID from teklab_finance_accounts => id.
taxkeyid number¹ Unique tax ID from teklab_finance_taxkeys => id.
sign string¹ Short posting information. (e.g. Invoice - IN11900123or Private withdrawals ...)
day number¹² Specifies the day of the booking.
month number¹² Specifies the month of the booking.
year number¹² Specifies the year of the booking.
moneyin decimal¹³ Amount of the debit entry. (e.g. 12.00 or -5.00)
moneyout decimal¹³ Amount of credit entry. (e.g. 12.00 or -5.00)

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Delete a transaction

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '<TekBase-URL>/api/v2/finance/transaction/1');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'authenticate: apikey=<API-Key>'
]);

$response = curl_exec($ch);

if (!$response) {
  die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

curl_close($ch);
?>
curl -X "DELETE" "<TekBase-URL>/api/v2/finance/transaction/1" \
  -H 'authenticate: apikey=<API-Key>' \

The above command returns JSON structured like this:

{
  "message": "SUCCESSFUL"
}

This endpoint delete a specific transaction.

HTTP Request

DELETE http://example.com/api/v2/finance/transaction/{id}

Request

Parameter Type Description
id number¹ The ID of the transaction to be deleted.

Reply

Parameter Type Description
message string Message with "SUCCESSFUL" text.

Errors

The Kittn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.