Send Logs
post
https://api.upswift.io/v1/
send_log_file
Send Logs
Restrictions:
  • Max file size: 20Mb
  • Max calls per minute per device: 1
  • Max total files that are being saved on Upswift servers: 30. If you upload a file with a name that already exists, it will be overridden. If you upload more than 30 files in total, the oldest file uploaded will be deleted and replaced by the new file.

Example

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}
file_name = "log.txt"
file_path = "/home/logs/log.txt"
json_payload = (None, json.dumps(json_content), 'application/json')
file_payload = (file_name, open(file_path, 'rb'), 'application/octet-stream')
final_payload = {'json': json_payload,'file': file_payload}
call_request = requests.post("https://api.upswift.io/v1/send_log_file", files=final_payload)
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)
else:
response_message = call_response["message"]
Copy link
Outline
post
Send Logs