This guide will explain how to integrate to the Microkeeper API as a software developer and get a Hello World response.
Step 1
Register a Microkeeper account, it's free for developers. Register
Step 2
Fill in the general settings with your business details.
The Business Name field will be displayed to users so they can see when your software has accessed their data.
Menu > Settings > Global > Business Name.
Step 3
Request Developer API access.
Contact Microkeeper and request your Developer key.
Once active the key will be displayed in the General settings
The developer key is used to identity your software and must be stored server side and never displayed to the user.
Step 4
Note following resources
Posting data URL
https://microkeeper.com.au/api_post.php
Required variables
The following variables are required when posting data to the Microkeeper API
Variable name | Purpose | Format | Example |
mk_biz_key | Used to identify which Microkeeper account to access. Each business has a unique key. This will need to be stored permanently in your database for automatic authentication of the user. | Alphanumeric 32 char | s5eLkc0t9LgkpxDIgo1IIwwqcs8oTytl |
mk_dev_key | Identify the software provider. Stored server side and never display this key to the user. | Alphanumeric 32 char | 3tsq34ta4tq2ars234rqr32tsatw4sq4 |
mk_action | What data is being posted or retrieved. | Lowercase Alphanumeric | hello_world |
mk_data | Data that is being posted. The requirements will vary depending on the mk_action variable | JSON | {"hello":"world"} |
Step 5
Post the data from your server, to the Microkeeper API.
This step will depend on the programming language of your choice.
Make sure to use the SSL protocol for production
PHP Example
This is a Hello World PHP example, just set the $mk_dev_key value and test the code below on your server
//////////////////////////////// //CONFIG /////////////////////////////// $mk_dev_key='';//Set this value once to identify your software $post_data['mk_biz_key']='s5eLkc0t9LgkpxDIgo1IIwwqcs8oTytl';//Dynamically set this depending on which user you want to access $post_data['mk_dev_key']=$mk_dev_key; $post_data['mk_action']='hello_world';//Set this depending on what data you want to access $post_data['mk_data']='{"hello":"world"}';//JSON data being sent //Traverse array and prepare data for posting (key1=value1) foreach($post_data as $key => $value) { $post_items[]=$key.'='.$value; } //Create the final string to be posted using implode() $post_string=implode('&', $post_items); //URL to hit server with NOTE HTTPS! $curl_connection=curl_init('https://microkeeper.com.au/api_post.php'); //Setup CURL curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT,30); curl_setopt($curl_connection, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);//set data to be posted $result=json_decode(curl_exec($curl_connection),true);//perform our request curl_close($curl_connection);//close the connection //output the response ?><pre><?php print_r($result);?></pre><?php
Step 6
Response
The response from the Microkeeper API is in JSON and will consist of 4 variable.
Variable name | Purpose | Format | Example |
success | Indicates if the transaction was success | Boolean | 1 |
authenticated | Indicates if the user passed authentication | Boolean | 1 |
message | Message from Microkeeper If success is true then this is a successful message If success is false then this is an error message | Text | 2 employees added |
data | Send data back to your API Will not be present if not required | JSON | {"hello":"world"} |
A response from a successful hello_world API call will look like this
{ "success":"1", "authenticated":"1", "message":"Hello World! Accessed: frogga" }
All successful API calls are logged in the activity feed.
The above hello_world example is displayed below.
Step 7
Go and enjoy a nice cold beer.