Change devices details

post
Change devices details

https://api.upswift.io/v1/devices_details
Using this call you can change the details of your devices.
Request
Response
Request
Form Data Parameters
apps
optional
array
A list of JSON objects that include the apps and their versions that you want to modify: [{"app_name":"<name>", "version": "<version>"}] Set the <name> as the name of the app (must exist in Upswift dashboard) and set the <version> as the version for that app.
tag
optional
string
A tag to add to the device.
user_token
required
string
This is your account token. Can be found under the Settings category on Upswift dashboard.
device_token
required
string
This is your device token.
device_name
optional
string
A new name for that device.
group
optional
string
The name of the group you want to switch for that device (the group must exist at the dashboard).
software_version
optional
string
Deprecated parameter - Use the apps parameter to modify software versions.
address
optional
string
A new address for that device. Please note, the address will be validated using Google Maps. Available only for Premium/Special plans.
lat
optional
string
A new Latitude for the device. (must be called with the lng parameter). Available only for Premium/Special plans.
lng
optional
string
A new Longitude for the device. (must be called with the lat parameter). Available only for Premium/Special plans.
description
optional
string
The description of the device. Can be anything you want.
Response
200: OK
Successfully updated device details.
{"message": "Success"}
400: Bad Request
Error occurred.
{"error_message": "<ERROR_MESSAGE>"}
429: Too Many Requests
Rate limit reached.
{}

You can set whichever parameters you would like to change on each request.

Example

Python
Python
import json
import requests
#Upswift tokens
user_token = "<user_token>"
device_token = "<device_token>"
json_content = {'user_token': user_token,
'device_token': device_token,
'device_name': 'new_device_name',
'group': 'Production',
'tag': 'test_tag',
'apps': [{'app_name': 'default_app', 'version': 'v1.1'}],
'description': 'Some kind of description for that device'}
call_request = requests.post("https://api.upswift.io/v1/devices_details", 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["error_message"]
print(error)