^
MK logo Login

Guides

Getting Started
  Introduction
  Your business settings
  Export from other systems
  Add an employee
  Clock on/off
  Timesheet Software
  Grouping Employees
  Locations

Rostering
  The roster process
  Roster templates
  Roster calendar
  Calendar View
  SMS Rosters

Timesheets
  The timesheet process
  Timesheet
  Timesheet vs roster
  Timesheet from roster

Payroll
  The payroll process
  A payrun
  Rate rules
  Shift rules
  Break rules
  Deduction rules
  Extra rules
  Time in lieu
  Public Holiday

Leave request
  The leave request process
  Leave request review
  Leave payroll process

Reports
  Group Certificates
  Xero Integration

Other features
  Messaging

SuperChoice
  Processing super

SuperChoice (Old process)
  Super clearing house
  SuperChoice setup
  Adding super fund
  Adding employees
  Super payment

Employees
  Employee console
  iPhone login
  Push notification
  Requesting leave

Developers
  Partner Logo
  API Hello World
  API Add employee

  Print Guide
Guide - api integration

Integration to the developer API


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 > General > Contact.




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 namePurposeFormatExample

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

Boolean1
authenticatedIndicates if the user passed authentication

Boolean1
messageMessage from Microkeeper
If success is true then this is a successful message
If success is false then this is an error message
Text2 employees added
dataSend 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.

Activity feed




Step 7

Complete

Go and enjoy a nice cold beer.