Make the necessary changes to upgrade ZeroKey API from v2 to v3.
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:
-
Visit the ZeroKey API webpage using this link.
-
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
eventHubUrlandapiURLand replace the valuev2withv3.
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/"
Replace LOCATION_UPDATE with LOCATION_RAW_UPDATE
-
Locate the lines containing
LOCATION_UPDATEand replace this value withLOCATION_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_UPDATEand replace this value withLOCATION_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.