Skip to main content
Skip table of contents

Migrating from ZeroKey's v2 to v3 API

This update is necessary when upgrading the Edge Compute Device (ECD) software from version 0.9 to version 1.0 or higher. Changes in the code must be made to maintain connectivity with the ZeroKey API.

Getting Started

To begin the transition from v2 to v3, follow these steps:

  1. Visit the ZeroKey API webpage using this link.

  2. Review the Introduction and What’s New sections for a clear understanding of how to interact with Quantum RTLS hardware using the ZeroKey API. Stay updated on new features, such as our API Quality of Service, MQTT TLS encryption, and certificate profile management. These updates enhance device control, real-time data management, security, and system performance.

Editing the Code

First, navigate to the directory where your API scripts are stored. Any and all scripts using ZeroKey’s v2 API must be updated to v3. Follow these steps:

Replace v2 with v3

  • Locate the lines beginning with eventHubUrl and apiURL and replace the value v2 with v3.

Old version:

eventHubUrl = "https://10.42.0.1:33001/hubs/eventHub"

apiUrl = "https://10.42.0.1:5000/v2/"

Updated version:

eventHubUrl = "https://10.42.0.1:33001/hubs/eventHub"

apiUrl = "https://10.42.0.1:5000/v3/"

image-20240606-185907.png NOTE: Ensure that the port numbers remain the same (33001 and 5000). Replace only the version numbers.

Replace LOCATION_UPDATE with LOCATION_RAW_UPDATE

  • Locate the lines containing LOCATION_UPDATE and replace this value with LOCATION_RAW_UPDATE.

Old version:

def handle_location_update(data):

json_str = data[0]

event_data = json.loads(json_str)

if event_data['Type'] == 'LOCATION_UPDATE':

print(f"Received LOCATION_UPDATE:{event_data}")

Updated version:

def handle_location_raw_update(data):

json_str = data[0]

event_data = json.loads(json_str)

if event_data['Type'] == 'LOCATION_RAW_UPDATE':

print(f"Received LOCATION_RAW_UPDATE:{event_data}")

Replace BATCH_LOCATION_UPDATE with LOCATION_BATCH_UPDATE

  • Locate the lines containing BATCH_LOCATION_UPDATE and replace this value with LOCATION_BATCH_UPDATE.

Old version:

def handle_batch_location_update(data):

json_str = data[0]

event_data = json.loads(json_str)

if event_data['Type'] == 'BATCH_LOCATION_UPDATE':

print(f"Received BATCH_LOCATION_UPDATE:{event_data}")

Updated version:

def handle location_batch_update(data):

json_str = data[0]

event_data = json.loads(json_str)

if event_data['Type'] == 'LOCATION_BATCH_UPDATE':

print(f"Received LOCATION_BATCH_UPDATE:{event_data}")

After making and saving these changes to your scripts, you will be able to access and retrieve data successfully using ZeroKey’s API.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.