How to use the Tuxx API?

Introduction

The Tuxx API can be used for retrieving valuable information from the Tuxx server (like validating IBAN numbers or retrieving the minimum wage). This page describes how to make calls to the Tuxx API and how to use the retrieved information. For the connection between your application and Tuxx, an additional library is required, one that can make requests using the REST protocol.

Example

PHP is a commonly used programming language. In this section, a connection will be made to the Tuxx server using PHP and the Httpful library.

Step 1: Get Tuxx API credentials

First of all, you need an application ID and application key to use the API. These can be requested on the sign up page. After signing up, the credentials will be sent directly to you.

Step 2: Install and unpack

Then, for this example, install the Httpful library on your server. Go to the "Httpful GitHub" page, download the library and unpack it to your server.

Step 3: Example code

After finishing these steps, it is finally possible to make an API call. Use the following code for making a call to the "Server Time" method for retrieving the server time from the Tuxx server.
require '/httpful/bootstrap.php';

// Please replace the values with your own application ID and application key
$appID = "Your application ID";
$appKey = "Your application key";

$url = "http://api.tuxx.co.uk/demo/server/time.php&app_id=" . $appID . "&app_key=" . $appKey;

// Make the REST request
$response = \Httpful\Request::get($url)->send();

if (!$response->hasErrors()) {
    // Display the server response
	var_dump($response->body);
} else {
    // The connection failed (maybe the application ID or application key is not valid)
    echo "Uh oh. The connection to the Tuxx API failed.";
}

Libraries

REST is a protocol which your application can use to communicate with the Tuxx server. There are hundreds of useful libraries written that can be used in order to make REST calls. It is up to you to decide what library you will use. In the following table, several libraries written by external developers are summed up. It is also possible to use another library written in the programming language you use.

Language Library
PHP Httpful
Laravel
Java Jersey
Python pyREST
C++ ffead-cpp

API overview

Check the API page for all APIs available.