Skip to content
Alex Wyett edited this page Feb 19, 2014 · 25 revisions

Introduction

What is an API?

An application programming interface (API) is intended to be used as an interface by software components to communicate with each other. Interacting with the API describes and prescribes the expected behavior of the software while the library is an actual implementation of this set of rules.

When used in the context of web development, an API is typically defined as a set of Hypertext Transfer Protocol (HTTP) request messages, along with a definition of the structure of response messages, which is usually in an Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format. While "Web API" is virtually a synonym for web service, the recent trend (so-called Web 2.0) has been moving away from Simple Object Access Protocol (SOAP) based services towards more direct Representational State Transfer (REST) style communications.

The practice of publishing APIs has allowed web communities to create an open architecture for sharing content and data between communities and applications. In this way, content that is created in one place can be dynamically posted and updated in multiple locations on the web.

How does this apply to tabs?

The tabs API provides a simple way for developers to make use of data contained within a tabs system, in a platform and language agnostic way. This allows developers with no knowledge of the internal workings of tabs to develop websites, iPhone apps, or to provide data to affiliates easily, without having to worry about how prices are calculated, what extras should be added onto a booking, or whether a booking is allowed based on a property's short-break rules.

For more examples see [Example Uses](https://github.com/CarltonSoftware/api-documentation/wiki/Example Uses)

Getting Started

Obtain an API key

In order to get started using the API you will first need an API key. You will need to get the customer whom you are developing on behalf of to request an API key for you. Please provide the following information along with your request:

  • Your name and contact details
  • Type of application being developed (website, iPhone app, etc)
  • IP addresses of servers that will require access to the API

Familiarise yourself with RESTful API's

The tabs API is known as a RESTful API. This means that it makes use of a lot of the functionality built into the Hypertext Transfer Protocol, which means developers can make use of existing technologies to interact with the API, without having to reinvent the wheel themselves.

Take a look at the endpoints provided by the API

Details of each of the endpoints provided by the API is available on http://docs.carltonsoftware.apiary.io/. For each endpoint you will find example URI's, status codes, headers and POST data (where relevant).

The API documentation also generates a mock-server, that you can send requests to from your application. An example of using this mock-server is included in the next section.

Try some example requests

The following examples make use of the API dynamically generated by our documentation.

Add in authentication

So far you will have been sending requests to the mock-server which doesn't require any authentication. When you start programming against the live API, you will be required to authenticate each request. Instructions on how to do that can be seen here.

Note

For post and put requests, please note that the provided data must be wrapped in an array with a key of 'data' (this is potentially for future enhancements), for example:

// Call a post end point
$response = ApiClient::post(
    '/post-endpoint',
    array(
        'data' => json_encode($requestData)
    )
);