Agent API
This REST API enables connecting embedded RTOS, windows CE or any other edge-device to Upswift platform.
post
https://api.upswift.io/v1/agent/
register_device
Register Device
If you receive status code 350, it means the device has been deleted from the dashboard. You must STOP sending Device Registration and Device Status calls.
Example
Python
import json
import requests
json_content = {'user_token': 'XXXXXXXXXXXXXXX',
'device_identifier': ['aa:bb:cc:dd:ee:11', 'aa:bb:cc:dd:ee:22'],
'project_name': 'TestProject',
'device_os': 'Windows CE',
'upswift_version': 'AgentAPI-v1',
'device_name': 'MyDevice1',
'device_group': 'Test',
'software_version': '1.0'}
call_request = requests.post("https://api.upswift.io/v1/agent/register_device", json=json_content)
call_response = json.loads(call_request.text)
if call_request.status_code != 200:
if call_request.status_code == 429:
error = "API limit reached"
elif call_request.status_code == 350:
### DEVICE IS DELETED
else:
error = call_response["message"]
print(error)
else:
device_token = call_response["message"]["device_token"]
get
https://api.upswift.io/v1/agent/
project_parameters
Project Parameters
Example
Python
import json
import requests
json_content = {'device_token': 'XXXXXXXXXXXXXXX'}
call_request = requests.get("https://api.upswift.io/v1/agent/project_parameters", json=json_content)
call_response = json.loads(call_request.text)
if call_request.status_code != 200:
if call_request.status_code == 429:
error = "API limit reached"
else:
error = call_response["message"]
print(error)
else:
status_timeout = call_response["message"]["status_timeout"]
post
https://api.upswift.io/v1/agent/
device_status
Device Status
If you receive status code 301, it means that the Project Parameters have been changed. You have to call the Project Parameters call as soon as possible.
Example
Python
import json
import requests
json_content = {'device_token': 'XXXXXXXXXXXXXXX',
'ram': 33,
'cpu': 12,
'disk_usage_total': 1200,
'disk_usage_current': 180,
'process_monitor': {"mysql": true,
"my_app": false}}
call_request = requests.post("https://api.upswift.io/v1/agent/device_status", json=json_content)
call_response = json.loads(call_request.text)
if call_request.status_code != 200:
if call_request.status_code == 429:
error = "API limit reached"
elif call_request.status_code == 301:
### NEW PROJECT PARAMETERS
else:
error = call_response["message"]
print(error)
Copy link
Outline
post
Register Device
get
Project Parameters
post
Device Status