Data monitor

Send Data Monitor Records

POST https://api.connect.jfrog.io/v1/send_app_monitor

Using this call, you can send any parameter and value from the edge device to Connect servers.

Request Body

NameTypeDescription

user_token

string

This is your account token. Can be found under the Settings category on Connect dashboard.

device_token

string

This is your device token.

app_parameters

array

A list of JSONs that represents all the parameters you want to send and their new values. The parameter names must exist at the Data Monitor category in the dashboard. The value's type you send can be either String, Integer, Float or Boolean. Example of an array: [{"app_parameter_name": "APP_PARAMETER_NAME", "app_parameter_value": "APP_PARAMETER_VALUE"}]

{"message": "Success"}

Example

import json
import requests


#Upswift tokens
user_token = "<user token>"
device_token = "<device token>"

json_content = {'user_token': user_token,
                'device_token': device_token,
                'app_parameters': [{'app_parameter_name': "Temperature", 'app_parameter_value': "23c"},
                                   {'app_parameter_name': "Counter", 'app_parameter_value': "123"}]}

call_request = requests.post("https://api.connect.jfrog.io/v1/send_app_monitor", 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)
else:
    response_message = call_response["message"]

Get Data Monitor Records

GET https://api.connect.jfrog.io/v1/app_monitor_details

Using this call, you will get the last 100 Data Monitor records that were received from your devices.

Request Body

NameTypeDescription

user_token

string

This is your account token. You can find it under the Settings category on the dashboard.

device_token

string

This is your device token.

project_name

string

This is the project name of the project you would like to get all its devices Data monitor records.

{"message": [{"device_id": 123456,
             "app_parameter_name": "Temperature",
             "app_parameter_value": "23",
             "created_time": "2020-02-08 16:12:11"}]}

If you set device_token, you will receive the records for that device regardless if you also set the project_name. If only project_name is set, you will receive records from all devices of that project. If both of them are not set, you will receive records from all devices from all projects.

Example

import json
import requests
json_content = {'device_token': 'XXXXXXXXXXXXXXXXX',
                'user_token': 'YYYYYYYYYYYYYYY',
                'project_name': "TestProject"}

call_request = requests.get("https://api.connect.jfrog.io/v1/app_monitor_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)
else:
    for record in call_response["message"]:
        device_uuid = record["device_uuid"]
        parameter_name = record["app_parameter_name"]
        record_value = record["app_parameter_value"]
        created_time = record["created_time"]

Last updated