Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Concept

The API is used to pass one or more commands to Microbizz. The commands are given in a collection, which again is wrapped in an envelope containing identification information such as the API-key, user name and/or password. When all commands has been executed, a structure is returned with the result of each command.

Versioning

Fields and commands are never removed from the API, but new fields can be implemented both in objects and command results. Therefore it is important that implementations against the API allows for this, in order to be forward-compatible.

Initial Configuration

In order to communicate with the Microbizz API one need an API key, a contract number and a valid username / password on that contract. These four pieces of information should be stored in the external app, as they are used as identification against Microbizz. Each component should be stored as strings.

...

The returned answer consists of an result envelope and the results lined up in the results structure. There is one result for each command passed.


Sending requests

Requests are preferably sent over HTTPS for security reasons, but can also be sent over normal HTTP with the normal risks of an unencrypted transaction.

...

https://system.microbizz.dk/api/endpoint.php?json=%7B%22contract%22%3A%22X%22%2C%22apikey%22%3A%22X%22%2C%22username%22%3A%22X%22%2C%22password%22%3A%22X%22%2C%22remoteagent%22%3A%22Microbizz+test%22%2C%22commands%22%3A%5B%7B%22command%22%3A%22Echo%22%2C%22text%22%3A%22Hello+World%22%7D%5D%7D


POST using curl

$command = array(...);

$envelope = array('contract' => 2391, 'apikey' => '3333-4444-5555-6666-7777-8888', 'username' => 'api@domain.inv', 'password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'haltonerror' => 1, 'commands' => array($command));

$json = json_encode($envelope);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://system.microbizz.dk/api/endpoint.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

$data = array('json' => $json);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);


Common mistakes

Remember to URL-encode the parameter.

...