Revision as of 19:50, 15 December 2016 by Admin (talk | contribs)

User API guide

From SimplyBook.me



Use our developer API to create your own booking interface. You can design any solution you want varying from simpliest widget to multifunctional application with functionality customized according to your business specific.

Simplybook Application Programming Interface uses JSON-RPC 2.0 protocol.

See an example of API-based booking interface, and also read the source code of this solution.

Autorization

Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method getToken on http://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select API plugin 'Settings'. Then you have to init remote access to Simplybook API. Your request should contain the following headers: 'X-Company-Login', 'X-Token'.

Getting the access-token can be implemented either from client side or from your server which is the more secure solution.

You may use javascript JSON-RPC-client library and php JSON-RPC-client library from our examples for your own solution development.

Client API(Company public service)authorization

Authorization from client side code
Getting the token-key.
var loginClient = new JSONRpcClient({
'url': 'http://user-api.simplybook.me' + '/login',
'onerror': function (error) {},
});
var token = loginClient.getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);

Initialization JSON-RPC-client.

this.client = new JSONRpcClient({<br>
	'url': 'http://user-api.simplybook.me',<br>
	'headers': {<br>
		'X-Company-Login': YOUR_COMPANY_LOGIN,<br>
		'X-Token': token<br>
	},<br>
	'onerror': function (error) {}<br>
});

Authorization from server side code Getting the token-key. $loginClient = new JsonRpcClient('http://user-api.simplybook.me' . '/login/'); $token = $loginClient->getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);