^Login

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

Register a Microkeeper account, it's free for developers. Register




Step 2 - Complete Required Account Settings

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.

  1. Menu > Settings > Global > Global Settings-Business
  2. Fill in the Business Name field




Step 3 - Generate your API keys

The API keys can be generated through the Global Settings area.

A Developer Key is used to access the API.

A Business Key is used to access the business data of an account through the API.


To find your Developer API key:

  1. Navigate to Menu > Settings > Global > Global Settings - Developers
  2. Click "Manage Developer API Keys"
  3. Click "Create New API Key"
  4. Enter an identification Title
  5. Your key will be generated. Copy this API Key for use. It will never be displayed again.


To generate a Business API key:

  1. Prerequisite: Make sure you are generating the Business API key in the correct Microkeeper account
  2. Navigate to Menu > Settings > Global > Global Settings - Developers
  3. Click "Manage Business API Keys"
  4. Click "Create New API Key"
  5. Enter a Title for the key
  6. Configure the Access Level for each Module
    1. Read Only - The key would only be able to read data from endpoints
    2. Read/Write - The key can read and write data to and from endpoints
  7. Click "Generate API Key"
  8. Your key will be generated. Copy this API Key for use. It will never be displayed again.


Remember that your API key is a secret! Do not share it with others or expose it in any client-side code (browsers, apps). API keys should be securely loaded from an environment variable or key management service on the server.



Step 4 - Post Data URL and Key Variables

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

1o7ayfmp092rmkrds7et7s3e3cnq3wqr

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 variableJSON{"hello":"world"}




Step 5 - Test Making an API Connection

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']='1o7ayfmp092rmkrds7et7s3e3cnq3wqr';//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

successIndicates if the transaction was successBoolean1
authenticatedIndicates if the user passed authenticationBoolean1
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

Congratulations, you made a successful connection!

If you are having any issues, contact our support team for assistance.