Application Protocol Interface (API) technical documentation

Our API allows developers and businesses to integrate all Wannaprint print services into their website, intranet or application. You can do everything from your intranet without need to browse our website : get products list, make an order, send modifications, confirm proof, etc...

Wether you are a corporate account or provide your customers with printed products, our API will fit your interconnection needs. The implementation process is quick and easy. Our support team will stay by your side to build up the best connection between your business and our services.

Authentication

A key is needed to use our API. Contact us and explain your project and we will provide you a valid API key.
Most of the methods must be authenticated (list below). The authentication process is sent securely through the API. You need the same valid login/password as on our website. Once authenticated, you will be provided by a session ID (token) what can be used to call again other methods without using login/password again.

Test and Production

We provide you a test environment for your development phase : testapi.wannaprint.com. This environment will allow you to make all the possible tests without engage your company into real printing production. Once your application is ready, you just have to switch to our real production server : api.wannaprint.com.

Methods

Methods execute specific functions on our system and return exploitable results. The following table presents all the available methods within our API and the documentation to use it.

Methods Authentication Description
test No Return "SUCCESS"
loginUser No Log a user for authentication
verifyToken Yes Verify if authentication is alive
refreshToken Yes Renew authentication token
createOrder Yes Create an order ID
listProducts Yes List of the products
addItem Yes Add an item associated to an order ID
logout Yes Remove authentication token

Query format

HTTP
Our API is a REST API, available via standard HTTP calls, using GET and POST queries with standard arguments.
More information about REST

Base URL
The base URL for the REST API is: http://testapi.wannaprint.com/Rest/1/[API Key]/

Return format
The data returned by the REST API is based on JSON standard format.
More information about JSON

Query Example
In this example, we call the "test" method.

	GET /Rest/1/[API Key]/api/test/ HTTP/1.0
	Host: testapi.wannaprint.com

Methods that use GET may also be called directly by URL. The URL in this example would be:
	http://testapi.wannaprint.com/Rest/1/[API Key]/api/test/

Response Example
	{
		"text":["SUCCESS"]
	}
   			

API kit

We propose a PHP kit to ease your developments on a higher level. No other languages are planned for the moment.
Don't remember to ask us for a valid API key, you will have to set up in your kit.

First you have to download one of our kits :
PHPkit.zip : single PHP script to insert in your application
PHPdemo.zip : complete demo with a web interface

Unzip the archive somewhere on your server. Edit the file called settings.php by replacing the API Key and API domain with the correct one we provided you.

	<?php
		define('API_KEY', 'your_key_here');
		define('API_DOMAIN', 'your_domain');
	?>
                
After that call our API using this PHP code:

	<?php
                
		include_once '[Installed path]/settings.php';
		include_once '[Installed path]/api.php';
			
		$apicaller = new ApiCaller(API_KEY, API_DOMAIN);
            
	?>
            
Call Methods
To make a call of a method you have to use this code:
	<?php
		session_start();
		$api_items = $apicaller->sendRequest(
							array(
								'controller' => 'api',
								'action' =>  '[method]',
								'argument 1' => value,
								….
								)
						      );
	?>