In a previous post, I showed how to get beacon info from Kontakt's REST service with unique ID. Now we want to be able to update values without logging into their dashboard. To do this you would:

< ?php

$url = '';
$prox = 'f7826da6-4fa2-4e98-8024-bc5b71e0893e'; // Kontakt Default UUID
$did = 'hr4U'; // Device ID, Unique ID
$alias = 'Nickname';
$key = 'YVMS1AZhgAEjC1Krg5X5tiI9AhhmpgbP' // Public API Key (use your own if you want to update beacon settings)

$rest = curl_init();

// Best effort to prevent MITM
curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($rest, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($rest, CURLOPT_CAINFO, "companyCA.cert");

// Only Unique ID required, rest optional and overwrites existing values if set - see
curl_setopt($rest, CURLOPT_URL, $url.$did."&alias=".$alias); // Sets a new alias

curl_setopt($rest, CURLOPT_RETURNTRANSFER, true);
curl_setopt($rest, CURLOPT_CUSTOMREQUEST, "POST");

// Should include Content-Type and User-Agent especially for POST operation
        array("Api-Key: ".$key,
                "Accept: application/;version=5",
				"Content-Type: application/x-www-form-urlencoded",
				"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36"));

$response = curl_exec($rest);

echo $response; // Returns success message


You may have noticed the verification that some of the initial CURL options are set with. The public key can be downloaded from their API address and with that you can make sure that you're actually talking to Kontakt's service.

The rest should be pretty straight forward as all the options besides the device ID can be changed. More details can be found on their API guide.