REST API

Using Upswift REST API, users can pull information of their devices fleet to make different actions such as schedule update deployments, send log files, change device name, etc..

Each device can send up to 3 API calls in a minute. If you reach the limit, you will receive an appropriate response code. Please check the response codes and send no more calls than the limit. Otherwise, your device may get banned for API calls. All calls require user_token and some of them require device_token.

The user_token can be found at the Settings category on Upswift dashboard under your account. The device_token can be found in the file /etc/upswift/service/settings.json on devices with agent version under 5.4, for devices with agent 5.4 and above, you can run the agent with the flag --print-token to receive the device token: /etc/upswift/service/UpswiftAgent --print-token

Here is a ready-to-use piece of code to pull user_token and device_token automatically with a Python script from the device (on devices with agent under version 5.4):

import json
import requests

UPSWIFT_SETTINGS_FILE = '/etc/upswift/service/settings.json'

#Pull Upswift tokens
with open(UPSWIFT_SETTINGS_FILE) as json_file:
   data = json.load(json_file)

#Upswift tokens
user_token = data['user_token']
device_token = data['device_token']

For devices with Upswift agent version 5.4 and above, you will have to get the user_token from Upswift dashboard and the device_token by running the agent on the device with the flag --print-token.

All endpoints' payload data is in JSON format.

Last updated