Notehub Py Library Overview
The Notehub Py library is a PyPI package built for Python applications. It provides a quick, Python-friendly way to connect to the Notehub API, and perform Notehub API requests with a clean, intuitive interface.
Installation
You can install the Notehub Py library in any Python application using the steps below.
In your project directory, run the following command from the terminal.
Using pip via PyPI:
python3 -m pip install notehub-pyOnce the package is installed, you can import it:
import notehub_pyUsage
Authentication
The Notehub Py library authenticates using a Personal Access Token (PAT). Pass your token via the Configuration object before making any API calls:
import notehub_py
configuration = notehub_py.Configuration(
access_token = "YOUR_ACCESS_TOKEN"
)Finding Your Project UID
Most API methods require a ProjectUID —
a unique identifier for your Notehub project in the format app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. You can find it on your project's Settings page in Notehub.
Example: Fetching Events
Here's a complete example that retrieves the most recent events from a project:
import notehub_py
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "YOUR_ACCESS_TOKEN"
)
project_uid = "app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
with notehub_py.ApiClient(configuration) as api_client:
api_instance = notehub_py.EventApi(api_client)
try:
response = api_instance.get_events(project_uid, page_size=10)
pprint(response)
except notehub_py.ApiException as e:
print(f"Error: {e}")Usage Limits
The Notehub API has usage limits. Exceeding the request threshold may result in 429 responses. See Notehub API Usage Limits for details.
API Reference
| API | Description |
|---|---|
| Device API | Manage devices, environment variables, and Notefiles |
| Event API | Query project and fleet events, with cursor and filter support |
| Jobs API | Manage and run Notehub batch jobs |
| Monitor API | Create and manage monitors that trigger alerts on event data |
| Organization API | Retrieve your organizations, their plans, and daily balance history |
| Project API | Manage projects, fleets, firmware, environment variables, and more |
| Route API | Create and manage routes for forwarding event data |
| Usage API | Query data, event, route log, and session usage by time range |
Device API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| add_db_note | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Add a note to a .db notefile |
| add_qi_note | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID} | Queue a note for a Notecard |
| create_notefile | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notefiles/{notefileID} | Create an empty notefile |
| delete_device | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID} | Delete a device |
| delete_device_environment_variable | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables/{key} | Delete a device environment variable |
| delete_note | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Delete a note |
| delete_notefiles | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files | Delete notefiles |
| disable_device | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/disable | Disable a device |
| enable_device | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/enable | Enable a device |
| get_db_note | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Get a note |
| get_device | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID} | Get a device |
| get_device_environment_hierarchy | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_hierarchy | Get a device's environment hierarchy |
| get_device_environment_variables | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables | Get device environment variables |
| get_device_environment_variables_by_pin | GET /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin | Get device environment variables using a PIN |
| get_device_health_log | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/health-log | Get a device's health log |
| get_device_journey | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys/{journeyID} | Get a journey and its events |
| get_device_journeys | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/journeys | List a device's journeys |
| get_device_latest_events | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/latest | Get a device's latest event per notefile |
| get_device_plans | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/plans | Get a device's cellular data plans |
| get_device_public_key | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/public-key | Get a device's public key |
| get_device_public_keys | GET /v1/projects/{projectOrProductUID}/devices/public-keys | List public keys of all devices |
| get_device_sessions | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/sessions | List a device's sessions |
| get_devices | GET /v1/projects/{projectOrProductUID}/devices | List devices in a project |
| get_fleet_devices | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/devices | List devices in a fleet |
| get_notefile | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID} | Get the notes in a notefile |
| get_sessions | GET /v1/projects/{projectOrProductUID}/sessions | List sessions in a project |
| list_notefiles | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files | List a device's notefiles and notes |
| provision_device | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/provision | Provision a Notecard |
| set_device_environment_variables | PUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables | Set device environment variables |
| set_device_environment_variables_by_pin | PUT /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin | Set device environment variables using a PIN |
| signal_device | POST /v1/projects/{projectOrProductUID}/devices/{deviceUID}/signal | Send a signal to a connected Notecard |
| update_db_note | PUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | Update a note in a .db notefile |
add_db_note
add_db_note(project_or_product_uid, device_uid, notefile_id, note_id, note_input)
Add a note to a .db notefile
Add a note with the given ID to a database notefile on a device, synced to the Notecard on its next sync. To change an existing note, use UpdateDbNote; to queue a note in a .qi notefile, use AddQiNote. Requires the Owner or Developer role. Returns 400 unless the notefile ends in .db or .dbs, or if payload isn't valid base64.
Example
import notehub_py
from notehub_py.models.note_input import NoteInput
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
note_id = "note_id_example" # str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
note_input = (
notehub_py.NoteInput()
) # NoteInput | Body or payload of note to be added to the device
try:
# Add a note to a .db notefile
api_instance.add_db_note(
project_or_product_uid, device_uid, notefile_id, note_id, note_input
)
except Exception as e:
print("Exception when calling DeviceApi->add_db_note: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| note_id | str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. | |
| note_input | NoteInput | Body or payload of note to be added to the device |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
add_qi_note
add_qi_note(project_or_product_uid, device_uid, notefile_id, note_input)
Queue a note for a Notecard
Add a note to an inbound queue (.qi) notefile on a device, creating the notefile if needed. The Notecard receives it on its next sync. For a .db notefile, use AddDbNote; to reach a connected Notecard immediately, use SignalDevice. Requires the Owner or Developer role. Returns 400 unless the notefile ends in .qi or .qis, or if payload isn't valid base64.
Example
import notehub_py
from notehub_py.models.note_input import NoteInput
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
note_input = (
notehub_py.NoteInput()
) # NoteInput | Body or payload of note to be added to the device
try:
# Queue a note for a Notecard
api_instance.add_qi_note(
project_or_product_uid, device_uid, notefile_id, note_input
)
except Exception as e:
print("Exception when calling DeviceApi->add_qi_note: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| note_input | NoteInput | Body or payload of note to be added to the device |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
create_notefile
create_notefile(project_or_product_uid, device_uid, notefile_id)
Create an empty notefile
Create an empty notefile on a device. AddQiNote creates a notefile when needed, so this is only required for an empty one. Requires the Owner or Developer role. Returns 400 if the notefile already exists.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
try:
# Create an empty notefile
api_instance.create_notefile(project_or_product_uid, device_uid, notefile_id)
except Exception as e:
print("Exception when calling DeviceApi->create_notefile: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_device
delete_device(project_or_product_uid, device_uid)
Delete a device
Delete a device and its notefiles from a project. Its events are kept. A Notecard that syncs again is added back as a new device; to block it instead, use DisableDevice. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Delete a device
api_instance.delete_device(project_or_product_uid, device_uid)
except Exception as e:
print("Exception when calling DeviceApi->delete_device: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_device_environment_variable
EnvironmentVariables delete_device_environment_variable(project_or_product_uid, device_uid, key)
Delete a device environment variable
Delete one device environment variable and return the ones left. Fleet and project variables with the same name then apply. Deleting a variable that doesn't exist succeeds. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
key = "key_example" # str | The environment variable key to delete.
try:
# Delete a device environment variable
api_response = api_instance.delete_device_environment_variable(
project_or_product_uid, device_uid, key
)
print("The response of DeviceApi->delete_device_environment_variable:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling DeviceApi->delete_device_environment_variable: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| key | str | The environment variable key to delete. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_note
delete_note(project_or_product_uid, device_uid, notefile_id, note_id)
Delete a note
Delete one note from a notefile on a device. To delete whole notefiles, use DeleteNotefiles. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
note_id = "note_id_example" # str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
try:
# Delete a note
api_instance.delete_note(
project_or_product_uid, device_uid, notefile_id, note_id
)
except Exception as e:
print("Exception when calling DeviceApi->delete_note: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| note_id | str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_notefiles
delete_notefiles(project_or_product_uid, device_uid, delete_notefiles_request)
Delete notefiles
Delete notefiles and all their notes from a device. To delete one note, use DeleteNote. Requires the Owner or Developer role. Returns 400 if files is empty.
Example
import notehub_py
from notehub_py.models.delete_notefiles_request import DeleteNotefilesRequest
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
delete_notefiles_request = (
notehub_py.DeleteNotefilesRequest()
) # DeleteNotefilesRequest | The notefiles to delete.
try:
# Delete notefiles
api_instance.delete_notefiles(
project_or_product_uid, device_uid, delete_notefiles_request
)
except Exception as e:
print("Exception when calling DeviceApi->delete_notefiles: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| delete_notefiles_request | DeleteNotefilesRequest | The notefiles to delete. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
disable_device
disable_device(project_or_product_uid, device_uid)
Disable a device
Stop a device from connecting to Notehub, ending any open session. The device and its data stay in the project; undo with EnableDevice. Does nothing if it's already disabled. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Disable a device
api_instance.disable_device(project_or_product_uid, device_uid)
except Exception as e:
print("Exception when calling DeviceApi->disable_device: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
enable_device
enable_device(project_or_product_uid, device_uid)
Enable a device
Re-enable a device turned off with DisableDevice, so it can connect to Notehub again. Does nothing if the device is already enabled. Requires the Owner or Developer role. Returns 409 if the device's cellular service was deactivated; it must be reactivated instead.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Enable a device
api_instance.enable_device(project_or_product_uid, device_uid)
except Exception as e:
print("Exception when calling DeviceApi->enable_device: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_db_note
GetDbNote200Response get_db_note(project_or_product_uid, device_uid, notefile_id, note_id, delete=delete, deleted=deleted)
Get a note
Get one note's body, payload and time from a notefile on a device. To get every note in a notefile, use GetNotefile. With delete=true, the note is deleted after it is read, which requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.models.get_db_note200_response import GetDbNote200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
note_id = "note_id_example" # str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
delete = True # bool | If true, delete the note after returning it. Requires the Owner or Developer role. (optional)
deleted = (
True # bool | If true, also return the note if it has been deleted. (optional)
)
try:
# Get a note
api_response = api_instance.get_db_note(
project_or_product_uid,
device_uid,
notefile_id,
note_id,
delete=delete,
deleted=deleted,
)
print("The response of DeviceApi->get_db_note:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_db_note: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| note_id | str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. | |
| delete | bool | If true, delete the note after returning it. Requires the Owner or Developer role. | [optional] |
| deleted | bool | If true, also return the note if it has been deleted. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device
Device get_device(project_or_product_uid, device_uid)
Get a device
Get one device's details: serial number, product, fleets, locations, firmware versions, SIM usage and DFU state. To find devices by tag, serial number or other fields, use GetDevices.
Example
import notehub_py
from notehub_py.models.device import Device
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Get a device
api_response = api_instance.get_device(project_or_product_uid, device_uid)
print("The response of DeviceApi->get_device:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_environment_hierarchy
EnvTreeJsonNode get_device_environment_hierarchy(project_or_product_uid, device_uid)
Get a device's environment hierarchy
Get a device's environment variables and the fleet and project variables it inherits, as a tree. Each variable has its precedence and whether it is used or overridden. For just the resolved values, use GetDeviceEnvironmentVariables.
Example
import notehub_py
from notehub_py.models.env_tree_json_node import EnvTreeJsonNode
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Get a device's environment hierarchy
api_response = api_instance.get_device_environment_hierarchy(
project_or_product_uid, device_uid
)
print("The response of DeviceApi->get_device_environment_hierarchy:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling DeviceApi->get_device_environment_hierarchy: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_environment_variables
GetDeviceEnvironmentVariablesByPin200Response get_device_environment_variables(project_or_product_uid, device_uid)
Get device environment variables
Get a device's own environment variables, its env.default values, and its effective values. Effective values merge in project and fleet variables, which device variables override. To see where each value comes from, use GetDeviceEnvironmentHierarchy.
Example
import notehub_py
from notehub_py.models.get_device_environment_variables_by_pin200_response import (
GetDeviceEnvironmentVariablesByPin200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Get device environment variables
api_response = api_instance.get_device_environment_variables(
project_or_product_uid, device_uid
)
print("The response of DeviceApi->get_device_environment_variables:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling DeviceApi->get_device_environment_variables: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
GetDeviceEnvironmentVariablesByPin200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_environment_variables_by_pin
GetDeviceEnvironmentVariablesByPin200Response get_device_environment_variables_by_pin(product_uid, device_uid, x_auth_token)
Get device environment variables using a PIN
Get a device's environment variables using its PIN instead of an API token. Pass the PIN in X-Auth-Token. Made for device dashboard pages; with a token, use GetDeviceEnvironmentVariables, which also returns effective values. Returns 401 if the project's device dashboard URL has no [pin], or the PIN is wrong.
Example
import notehub_py
from notehub_py.models.get_device_environment_variables_by_pin200_response import (
GetDeviceEnvironmentVariablesByPin200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
product_uid = "com.blues.bridge:sensors" # str |
device_uid = "dev:000000000000000" # str |
x_auth_token = (
"x_auth_token_example" # str | The device's PIN, used instead of an API token.
)
try:
# Get device environment variables using a PIN
api_response = api_instance.get_device_environment_variables_by_pin(
product_uid, device_uid, x_auth_token
)
print("The response of DeviceApi->get_device_environment_variables_by_pin:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling DeviceApi->get_device_environment_variables_by_pin: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| product_uid | str | ||
| device_uid | str | ||
| x_auth_token | str | The device's PIN, used instead of an API token. |
Return type
GetDeviceEnvironmentVariablesByPin200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_health_log
GetDeviceHealthLog200Response get_device_health_log(project_or_product_uid, device_uid, start_date=start_date, end_date=end_date, log_type=log_type)
Get a device's health log
Get a device's health log: timestamped status messages such as restarts and completed firmware updates. Only the latest 100 entries are kept. To filter by date, pass both startDate and endDate; startDate alone returns 400, and the same value for both returns every entry.
Example
import notehub_py
from notehub_py.models.get_device_health_log200_response import (
GetDeviceHealthLog200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
log_type = [
"log_type_example"
] # List[str] | Return only these kinds of entry. If omitted, all entries are returned. - `boot`: the device restarted - `dfu_completed`: a host firmware update finished (optional)
try:
# Get a device's health log
api_response = api_instance.get_device_health_log(
project_or_product_uid,
device_uid,
start_date=start_date,
end_date=end_date,
log_type=log_type,
)
print("The response of DeviceApi->get_device_health_log:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_health_log: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| log_type | List[str] | Return only these kinds of entry. If omitted, all entries are returned. - `boot`: the device restarted - `dfu_completed`: a host firmware update finished | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_journey
GetDeviceJourney200Response get_device_journey(project_or_product_uid, device_uid, journey_id, page_size=page_size, page_num=page_num)
Get a journey and its events
Get one journey's start and end time and its events, oldest first. Only events with a location are included, and a run of events at the same location is reduced to the first. The events are paginated; journey.has_more is true if there are more. Returns 404 if the journey doesn't exist, and 403 if the organization is suspended.
Example
import notehub_py
from notehub_py.models.get_device_journey200_response import GetDeviceJourney200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
journey_id = 56 # int | Identifier of the journey, taken from the numeric `journey` field in the event body (a Unix timestamp marking the start of the journey).
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
try:
# Get a journey and its events
api_response = api_instance.get_device_journey(
project_or_product_uid,
device_uid,
journey_id,
page_size=page_size,
page_num=page_num,
)
print("The response of DeviceApi->get_device_journey:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_journey: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| journey_id | int | Identifier of the journey, taken from the numeric `journey` field in the event body (a Unix timestamp marking the start of the journey). | |
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_journeys
GetDeviceJourneys200Response get_device_journeys(project_or_product_uid, device_uid, start_date=start_date, end_date=end_date)
List a device's journeys
List a device's journeys, newest first, without their events. A journey is the events whose body has the same journey value and a jcount field; one-event journeys are left out. For a journey's events, use GetDeviceJourney. Returns at most 100; has_more is true if there are more. startDate and endDate filter on the journey's start. Returns 403 if the organization is suspended.
Example
import notehub_py
from notehub_py.models.get_device_journeys200_response import (
GetDeviceJourneys200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
try:
# List a device's journeys
api_response = api_instance.get_device_journeys(
project_or_product_uid, device_uid, start_date=start_date, end_date=end_date
)
print("The response of DeviceApi->get_device_journeys:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_journeys: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_latest_events
GetDeviceLatestEvents200Response get_device_latest_events(project_or_product_uid, device_uid)
Get a device's latest event per notefile
Get the most recent event from each of a device's notefiles, sorted by notefile name. _env.qo is left out. To search a device's event history, use GetEvents. Returns 403 if the organization is suspended.
Example
import notehub_py
from notehub_py.models.get_device_latest_events200_response import (
GetDeviceLatestEvents200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Get a device's latest event per notefile
api_response = api_instance.get_device_latest_events(
project_or_product_uid, device_uid
)
print("The response of DeviceApi->get_device_latest_events:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_latest_events: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
GetDeviceLatestEvents200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_plans
GetDevicePlans200Response get_device_plans(project_or_product_uid, device_uid)
Get a device's cellular data plans
Get the data plan of each cellular SIM in a device: plan type, data used and remaining, and expiry. Covers the built-in SIM and any external SIM, but not satellite plans. Returns 404 if the device has no cellular or satellite SIM.
Example
import notehub_py
from notehub_py.models.get_device_plans200_response import GetDevicePlans200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Get a device's cellular data plans
api_response = api_instance.get_device_plans(project_or_product_uid, device_uid)
print("The response of DeviceApi->get_device_plans:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_plans: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_public_key
GetDevicePublicKey200Response get_device_public_key(project_or_product_uid, device_uid)
Get a device's public key
Get one Notecard's public key, in PEM format. For every device in the project, use GetDevicePublicKeys.
Example
import notehub_py
from notehub_py.models.get_device_public_key200_response import (
GetDevicePublicKey200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# Get a device's public key
api_response = api_instance.get_device_public_key(
project_or_product_uid, device_uid
)
print("The response of DeviceApi->get_device_public_key:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_public_key: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_public_keys
GetDevicePublicKeys200Response get_device_public_keys(project_or_product_uid, page_size=page_size, page_num=page_num, cursor=cursor)
List public keys of all devices
List the public key of every device in a project. For one device, use GetDevicePublicKey. Paginated. Deleted devices are included only when reading with a cursor.
Example
import notehub_py
from notehub_py.models.get_device_public_keys200_response import (
GetDevicePublicKeys200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
try:
# List public keys of all devices
api_response = api_instance.get_device_public_keys(
project_or_product_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
)
print("The response of DeviceApi->get_device_public_keys:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_public_keys: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
Return type
GetDevicePublicKeys200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_sessions
GetDeviceSessions200Response get_device_sessions(project_or_product_uid, device_uid, page_size=page_size, page_num=page_num, cursor=cursor, start_date=start_date, end_date=end_date, first_sync=first_sync)
List a device's sessions
List a device's sessions, its connections to Notehub. Each shows why it opened and closed, signal strength, location and data usage. startDate and endDate filter on when the session began. For every device's sessions, use GetSessions. Paginated.
Example
import notehub_py
from notehub_py.models.get_device_sessions200_response import (
GetDeviceSessions200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
first_sync = False # bool | If true, return only sessions whose `why_session_opened` begins with \"first sync\". (optional) (default to False)
try:
# List a device's sessions
api_response = api_instance.get_device_sessions(
project_or_product_uid,
device_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
start_date=start_date,
end_date=end_date,
first_sync=first_sync,
)
print("The response of DeviceApi->get_device_sessions:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_device_sessions: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| first_sync | bool | If true, return only sessions whose `why_session_opened` begins with "first sync". | [optional] [default to False] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_devices
GetDevices200Response get_devices(project_or_product_uid, page_size=page_size, page_num=page_num, cursor=cursor, device_uid=device_uid, tag=tag, serial_number=serial_number, fleet_uid=fleet_uid, notecard_firmware=notecard_firmware, location=location, host_firmware=host_firmware, product_uid=product_uid, sku=sku)
List devices in a project
List the devices in a project, with optional filters such as tag, serial number, fleet, location and firmware version. For one fleet's devices, use GetFleetDevices. Paginated.
Example
import notehub_py
from notehub_py.models.get_devices200_response import GetDevices200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
tag = [
"tag_example"
] # List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`. (optional)
serial_number = [
"serial_number_example"
] # List[str] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
fleet_uid = ["fleet_uid_example"] # List[str] | (optional)
notecard_firmware = [
"notecard_firmware_example"
] # List[str] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
location = [
"location_example"
] # List[str] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
host_firmware = [
"host_firmware_example"
] # List[str] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
product_uid = [
"product_uid_example"
] # List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
sku = [
"sku_example"
] # List[str] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
try:
# List devices in a project
api_response = api_instance.get_devices(
project_or_product_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
device_uid=device_uid,
tag=tag,
serial_number=serial_number,
fleet_uid=fleet_uid,
notecard_firmware=notecard_firmware,
location=location,
host_firmware=host_firmware,
product_uid=product_uid,
sku=sku,
)
print("The response of DeviceApi->get_devices:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_devices: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| tag | List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serial_number | List[str] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleet_uid | List[str] | [optional] | |
| notecard_firmware | List[str] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | List[str] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| host_firmware | List[str] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| product_uid | List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | List[str] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_fleet_devices
GetDevices200Response get_fleet_devices(project_or_product_uid, fleet_uid, page_size=page_size, page_num=page_num, cursor=cursor, device_uid=device_uid, tag=tag, serial_number=serial_number, notecard_firmware=notecard_firmware, location=location, host_firmware=host_firmware, product_uid=product_uid, sku=sku)
List devices in a fleet
List the devices in one fleet, with the same filters as GetDevices. To list a device's fleets instead, use GetDeviceFleets. Paginated. Returns 404 if the fleet doesn't exist.
Example
import notehub_py
from notehub_py.models.get_devices200_response import GetDevices200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
tag = [
"tag_example"
] # List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`. (optional)
serial_number = [
"serial_number_example"
] # List[str] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
notecard_firmware = [
"notecard_firmware_example"
] # List[str] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
location = [
"location_example"
] # List[str] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
host_firmware = [
"host_firmware_example"
] # List[str] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
product_uid = [
"product_uid_example"
] # List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
sku = [
"sku_example"
] # List[str] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
try:
# List devices in a fleet
api_response = api_instance.get_fleet_devices(
project_or_product_uid,
fleet_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
device_uid=device_uid,
tag=tag,
serial_number=serial_number,
notecard_firmware=notecard_firmware,
location=location,
host_firmware=host_firmware,
product_uid=product_uid,
sku=sku,
)
print("The response of DeviceApi->get_fleet_devices:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_fleet_devices: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| tag | List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serial_number | List[str] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| notecard_firmware | List[str] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | List[str] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| host_firmware | List[str] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| product_uid | List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | List[str] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_notefile
GetNotefile200Response get_notefile(project_or_product_uid, device_uid, notefile_id, max=max, deleted=deleted, delete=delete)
Get the notes in a notefile
Get the notes in one notefile on a device. For a .qi notefile, that's the notes still queued; for a .db notefile, every note. To list all of a device's notefiles with their notes, use ListNotefiles. With delete=true, the returned notes are deleted, which requires the Owner or Developer role. Returns 400 if notefileID has no valid notefile extension.
Example
import notehub_py
from notehub_py.models.get_notefile200_response import GetNotefile200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
max = 56 # int | The most notes to return. (optional)
deleted = True # bool | If true, also return deleted notes. (optional)
delete = True # bool | If true, delete the notes this request returns. Requires the Owner or Developer role. (optional)
try:
# Get the notes in a notefile
api_response = api_instance.get_notefile(
project_or_product_uid,
device_uid,
notefile_id,
max=max,
deleted=deleted,
delete=delete,
)
print("The response of DeviceApi->get_notefile:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_notefile: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| max | int | The most notes to return. | [optional] |
| deleted | bool | If true, also return deleted notes. | [optional] |
| delete | bool | If true, delete the notes this request returns. Requires the Owner or Developer role. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_sessions
GetDeviceSessions200Response get_sessions(project_or_product_uid, page_size=page_size, page_num=page_num, cursor=cursor, start_date=start_date, end_date=end_date, first_sync=first_sync, device_uid=device_uid, fleet_uid=fleet_uid)
List sessions in a project
List the sessions of every device in a project, as GetDeviceSessions does for one device. startDate and endDate filter on when the session began. deviceUID and fleetUID each match any of their values; fleetUID matches the fleets recorded on the session. Paginated.
Example
import notehub_py
from notehub_py.models.get_device_sessions200_response import (
GetDeviceSessions200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
first_sync = False # bool | If true, return only sessions whose `why_session_opened` begins with \"first sync\". (optional) (default to False)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
fleet_uid = ["fleet_uid_example"] # List[str] | (optional)
try:
# List sessions in a project
api_response = api_instance.get_sessions(
project_or_product_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
start_date=start_date,
end_date=end_date,
first_sync=first_sync,
device_uid=device_uid,
fleet_uid=fleet_uid,
)
print("The response of DeviceApi->get_sessions:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->get_sessions: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| first_sync | bool | If true, return only sessions whose `why_session_opened` begins with "first sync". | [optional] [default to False] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| fleet_uid | List[str] | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
list_notefiles
List[Notefile] list_notefiles(project_or_product_uid, device_uid, files=files, pending=pending)
List a device's notefiles and notes
List a device's notefiles with the notes in each, sorted .qo, then .qi, then .db. .qo notefiles are listed without notes, since Notehub empties them as it processes them. Most system notefiles (names starting with _) are left out. For one notefile, use GetNotefile.
Example
import notehub_py
from notehub_py.models.notefile import Notefile
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
files = [
"files_example"
] # List[str] | Notefiles to include, e.g. `config.db`. If omitted, all are listed. (optional)
pending = (
True # bool | show only files that are pending sync to the Notecard (optional)
)
try:
# List a device's notefiles and notes
api_response = api_instance.list_notefiles(
project_or_product_uid, device_uid, files=files, pending=pending
)
print("The response of DeviceApi->list_notefiles:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->list_notefiles: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| files | List[str] | Notefiles to include, e.g. `config.db`. If omitted, all are listed. | [optional] |
| pending | bool | show only files that are pending sync to the Notecard | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
provision_device
object provision_device(project_or_product_uid, device_uid, provision_device_request)
Provision a Notecard
Add a Notecard to a project before it first connects, with its product, serial number and fleets. A device that already exists isn't reset and keeps its fleets. Requires the Owner or Developer role. Returns 404 if product_uid doesn't exist, and 400 if it belongs to another project or deviceUID isn't a valid Notecard DeviceUID.
Example
import notehub_py
from notehub_py.models.provision_device_request import ProvisionDeviceRequest
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
provision_device_request = (
notehub_py.ProvisionDeviceRequest()
) # ProvisionDeviceRequest | The product, serial number and fleets for the device.
try:
# Provision a Notecard
api_response = api_instance.provision_device(
project_or_product_uid, device_uid, provision_device_request
)
print("The response of DeviceApi->provision_device:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->provision_device: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| provision_device_request | ProvisionDeviceRequest | The product, serial number and fleets for the device. |
Return type
object
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
set_device_environment_variables
EnvironmentVariables set_device_environment_variables(project_or_product_uid, device_uid, environment_variables)
Set device environment variables
Add or change a device's environment variables; variables you don't send keep their values. A value of \"\" or - deletes that variable. Setting _fw, _fwc or _fwm starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 400 if a note's key isn't a variable.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
environment_variables = (
notehub_py.EnvironmentVariables()
) # EnvironmentVariables | The variables to add or change, and optional notes.
try:
# Set device environment variables
api_response = api_instance.set_device_environment_variables(
project_or_product_uid, device_uid, environment_variables
)
print("The response of DeviceApi->set_device_environment_variables:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling DeviceApi->set_device_environment_variables: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| environment_variables | EnvironmentVariables | The variables to add or change, and optional notes. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
set_device_environment_variables_by_pin
EnvironmentVariables set_device_environment_variables_by_pin(product_uid, device_uid, x_auth_token, environment_variables)
Set device environment variables using a PIN
Add or change a device's environment variables using its PIN instead of an API token. Pass the PIN in X-Auth-Token. Works like SetDeviceEnvironmentVariables: a value of \"\" or - deletes that variable. Returns 401 if the project's device dashboard URL has no [pin], or the PIN is wrong.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
product_uid = "com.blues.bridge:sensors" # str |
device_uid = "dev:000000000000000" # str |
x_auth_token = (
"x_auth_token_example" # str | The device's PIN, used instead of an API token.
)
environment_variables = (
notehub_py.EnvironmentVariables()
) # EnvironmentVariables | The variables to add or change, and optional notes.
try:
# Set device environment variables using a PIN
api_response = api_instance.set_device_environment_variables_by_pin(
product_uid, device_uid, x_auth_token, environment_variables
)
print("The response of DeviceApi->set_device_environment_variables_by_pin:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling DeviceApi->set_device_environment_variables_by_pin: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| product_uid | str | ||
| device_uid | str | ||
| x_auth_token | str | The device's PIN, used instead of an API token. | |
| environment_variables | EnvironmentVariables | The variables to add or change, and optional notes. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
signal_device
SignalDevice200Response signal_device(project_or_product_uid, device_uid, body)
Send a signal to a connected Notecard
Send a JSON object straight to a Notecard, which the host can read with hub.signal. It's delivered only if the Notecard is connected to Notehub at that moment, and is never queued; connected in the response says whether it was. To queue data for the next sync, use AddQiNote instead. Requires the Owner or Developer role. Returns 400 if the body has a type field.
Example
import notehub_py
from notehub_py.models.body import Body
from notehub_py.models.signal_device200_response import SignalDevice200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
body = notehub_py.Body() # Body | The signal to send.
try:
# Send a signal to a connected Notecard
api_response = api_instance.signal_device(
project_or_product_uid, device_uid, body
)
print("The response of DeviceApi->signal_device:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DeviceApi->signal_device: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| body | Body | The signal to send. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
update_db_note
update_db_note(project_or_product_uid, device_uid, notefile_id, note_id, note_input)
Update a note in a .db notefile
Replace the body and payload of a note in a database notefile on a device, synced to the Notecard on its next sync. To add a new note, use AddDbNote. Requires the Owner or Developer role. Returns 400 unless the notefile ends in .db or .dbs, or if payload isn't valid base64.
Example
import notehub_py
from notehub_py.models.note_input import NoteInput
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.DeviceApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
notefile_id = "notefile_id_example" # str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`.
note_id = "note_id_example" # str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`.
note_input = (
notehub_py.NoteInput()
) # NoteInput | Body or payload of note to be added to the device
try:
# Update a note in a .db notefile
api_instance.update_db_note(
project_or_product_uid, device_uid, notefile_id, note_id, note_input
)
except Exception as e:
print("Exception when calling DeviceApi->update_db_note: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| notefile_id | str | Notefile name, including its extension, e.g. `config.db` or `commands.qi`. | |
| note_id | str | Note ID within the notefile, e.g. `my_note`. Notes in a `.qi` notefile have IDs like `1:435`. | |
| note_input | NoteInput | Body or payload of note to be added to the device |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
Event API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| get_events | GET /v1/projects/{projectOrProductUID}/events | List events in a project |
| get_fleet_events | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/events | List events in a fleet |
| get_route_logs_by_event | GET /v1/projects/{projectOrProductUID}/events/{eventUID}/route-logs | Get an event's route logs |
get_events
GetEvents200Response get_events(project_or_product_uid, page_size=page_size, page_num=page_num, cursor=cursor, device_uid=device_uid, sensor_uid=sensor_uid, sort_by=sort_by, sort_order=sort_order, start_date=start_date, end_date=end_date, date_type=date_type, system_files_only=system_files_only, files=files, format=format, serial_number=serial_number, fleet_uid=fleet_uid, session_uid=session_uid, event_uid=event_uid, select_fields=select_fields)
List events in a project
List a project's events, filtered by device, notefile, date, fleet, session and more. Use cursor to read events in the order Notehub stored them and to poll for new ones. Set format=csv for CSV. For one fleet, use GetFleetEvents. Paginated. Returns 403 if the organization is suspended, and 500 if the query times out; narrow the filters and retry.
Example
import notehub_py
from notehub_py.models.get_events200_response import GetEvents200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.EventApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
sensor_uid = [
"sensor_uid_example"
] # List[str] | SensorUID to filter by, matched exactly. Repeat for more than one. (optional)
sort_by = "captured" # str | (optional) (default to 'captured')
sort_order = "asc" # str | (optional) (default to 'asc')
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
date_type = "captured" # str | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it (optional) (default to 'captured')
system_files_only = True # bool | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. (optional)
files = "_health.qo, data.qo" # str | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. (optional)
format = "json" # str | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields` (optional) (default to 'json')
serial_number = [
"serial_number_example"
] # List[str] | Serial number to filter by. Repeat for more than one. (optional)
fleet_uid = ["fleet_uid_example"] # List[str] | Filter by FleetUID (optional)
session_uid = [
"session_uid_example"
] # List[str] | SessionUID to filter by. Repeat for more than one. (optional)
event_uid = [
"event_uid_example"
] # List[str] | EventUID to filter by. Repeat for more than one. (optional)
select_fields = "select_fields_example" # str | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns. (optional)
try:
# List events in a project
api_response = api_instance.get_events(
project_or_product_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
device_uid=device_uid,
sensor_uid=sensor_uid,
sort_by=sort_by,
sort_order=sort_order,
start_date=start_date,
end_date=end_date,
date_type=date_type,
system_files_only=system_files_only,
files=files,
format=format,
serial_number=serial_number,
fleet_uid=fleet_uid,
session_uid=session_uid,
event_uid=event_uid,
select_fields=select_fields,
)
print("The response of EventApi->get_events:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EventApi->get_events: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| sensor_uid | List[str] | SensorUID to filter by, matched exactly. Repeat for more than one. | [optional] |
| sort_by | str | [optional] [default to 'captured'] | |
| sort_order | str | [optional] [default to 'asc'] | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| date_type | str | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it | [optional] [default to 'captured'] |
| system_files_only | bool | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. | [optional] |
| files | str | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. | [optional] |
| format | str | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields` | [optional] [default to 'json'] |
| serial_number | List[str] | Serial number to filter by. Repeat for more than one. | [optional] |
| fleet_uid | List[str] | Filter by FleetUID | [optional] |
| session_uid | List[str] | SessionUID to filter by. Repeat for more than one. | [optional] |
| event_uid | List[str] | EventUID to filter by. Repeat for more than one. | [optional] |
| select_fields | str | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, text/csv
get_fleet_events
GetEvents200Response get_fleet_events(project_or_product_uid, fleet_uid, page_size=page_size, page_num=page_num, cursor=cursor, device_uid=device_uid, sensor_uid=sensor_uid, sort_by=sort_by, sort_order=sort_order, start_date=start_date, end_date=end_date, date_type=date_type, system_files_only=system_files_only, files=files, format=format, serial_number=serial_number, session_uid=session_uid, event_uid=event_uid, select_fields=select_fields)
List events in a fleet
List the events from one fleet, with the same filters, cursor and CSV output as GetEvents. Paginated. Returns 403 if the organization is suspended, and 500 if the query times out; narrow the filters and retry.
Example
import notehub_py
from notehub_py.models.get_events200_response import GetEvents200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.EventApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
sensor_uid = [
"sensor_uid_example"
] # List[str] | SensorUID to filter by, matched exactly. Repeat for more than one. (optional)
sort_by = "captured" # str | (optional) (default to 'captured')
sort_order = "asc" # str | (optional) (default to 'asc')
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
date_type = "captured" # str | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it (optional) (default to 'captured')
system_files_only = True # bool | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. (optional)
files = "_health.qo, data.qo" # str | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. (optional)
format = "json" # str | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields` (optional) (default to 'json')
serial_number = [
"serial_number_example"
] # List[str] | Serial number to filter by. Repeat for more than one. (optional)
session_uid = [
"session_uid_example"
] # List[str] | SessionUID to filter by. Repeat for more than one. (optional)
event_uid = [
"event_uid_example"
] # List[str] | EventUID to filter by. Repeat for more than one. (optional)
select_fields = "select_fields_example" # str | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns. (optional)
try:
# List events in a fleet
api_response = api_instance.get_fleet_events(
project_or_product_uid,
fleet_uid,
page_size=page_size,
page_num=page_num,
cursor=cursor,
device_uid=device_uid,
sensor_uid=sensor_uid,
sort_by=sort_by,
sort_order=sort_order,
start_date=start_date,
end_date=end_date,
date_type=date_type,
system_files_only=system_files_only,
files=files,
format=format,
serial_number=serial_number,
session_uid=session_uid,
event_uid=event_uid,
select_fields=select_fields,
)
print("The response of EventApi->get_fleet_events:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EventApi->get_fleet_events: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str | ||
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| sensor_uid | List[str] | SensorUID to filter by, matched exactly. Repeat for more than one. | [optional] |
| sort_by | str | [optional] [default to 'captured'] | |
| sort_order | str | [optional] [default to 'asc'] | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| date_type | str | Which time `startDate` and `endDate` filter on. - `captured`: when the Notecard created the event - `uploaded`: when Notehub received it | [optional] [default to 'captured'] |
| system_files_only | bool | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. | [optional] |
| files | str | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. | [optional] |
| format | str | Response format. - `json`: a JSON object with `events` - `csv`: CSV, with the columns in `selectFields` | [optional] [default to 'json'] |
| serial_number | List[str] | Serial number to filter by. Repeat for more than one. | [optional] |
| session_uid | List[str] | SessionUID to filter by. Repeat for more than one. | [optional] |
| event_uid | List[str] | EventUID to filter by. Repeat for more than one. | [optional] |
| select_fields | str | Comma-separated event fields to return, e.g. `device,when,body.temp`. Also sets the CSV columns. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, text/csv
get_route_logs_by_event
List[RouteLog] get_route_logs_by_event(project_or_product_uid, event_uid)
Get an event's route logs
Get the log of every attempt to send one event to each route, with the response status, body and duration. For a route's logs across events, use GetRouteLogsByRoute. Returns 404 if the event doesn't exist.
Example
import notehub_py
from notehub_py.models.route_log import RouteLog
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.EventApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
event_uid = "4506f411-dea6-44a0-9743-1130f57d7747" # str | EventUID, e.g. `4506f411-dea6-44a0-9743-1130f57d7747`.
try:
# Get an event's route logs
api_response = api_instance.get_route_logs_by_event(
project_or_product_uid, event_uid
)
print("The response of EventApi->get_route_logs_by_event:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EventApi->get_route_logs_by_event: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| event_uid | str | EventUID, e.g. `4506f411-dea6-44a0-9743-1130f57d7747`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
Jobs API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| cancel_job_run | POST /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID}/cancel | Cancel a job run |
| create_job | POST /v1/projects/{projectOrProductUID}/jobs | Create a batch job |
| delete_job | DELETE /v1/projects/{projectOrProductUID}/jobs/{jobUID} | Delete a batch job |
| delete_job_run | DELETE /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID} | Delete a job run |
| get_job | GET /v1/projects/{projectOrProductUID}/jobs/{jobUID} | Get a batch job |
| get_job_run | GET /v1/projects/{projectOrProductUID}/jobs/runs/{reportUID} | Get a job run |
| get_job_runs | GET /v1/projects/{projectOrProductUID}/jobs/{jobUID}/runs | List a job's runs |
| get_jobs | GET /v1/projects/{projectOrProductUID}/jobs | List batch jobs |
| run_job | POST /v1/projects/{projectOrProductUID}/jobs/{jobUID}/run | Run a batch job |
cancel_job_run
CancelJobRun200Response cancel_job_run(project_or_product_uid, report_uid)
Cancel a job run
Ask a running job to stop. successful is false if the run couldn't be cancelled. Requires the Owner or Developer role. Returns 404 if the run doesn't exist.
Example
import notehub_py
from notehub_py.models.cancel_job_run200_response import CancelJobRun200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
report_uid = "my-reconciliation-job-1707654321000" # str | Job run UID, as returned by `RunJob`.
try:
# Cancel a job run
api_response = api_instance.cancel_job_run(project_or_product_uid, report_uid)
print("The response of JobsApi->cancel_job_run:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->cancel_job_run: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| report_uid | str | Job run UID, as returned by `RunJob`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
create_job
CreateJob201Response create_job(project_or_product_uid, name, job_definition)
Create a batch job
Create a batch job from a definition that selects devices and the changes to make to them. It doesn't run until RunJob. Each call creates a new job with its own UID; names needn't be unique. Requires the Owner or Developer role. Returns 400 without a name; an invalid definition returns 500.
Example
import notehub_py
from notehub_py.models.create_job201_response import CreateJob201Response
from notehub_py.models.job_definition import JobDefinition
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
name = (
"name_example" # str | Job name, shown in lists. It doesn't have to be unique.
)
job_definition = (
notehub_py.JobDefinition()
) # JobDefinition | The batch job definition
try:
# Create a batch job
api_response = api_instance.create_job(
project_or_product_uid, name, job_definition
)
print("The response of JobsApi->create_job:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->create_job: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| name | str | Job name, shown in lists. It doesn't have to be unique. | |
| job_definition | JobDefinition | The batch job definition |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
delete_job
DeleteJob200Response delete_job(project_or_product_uid, job_uid)
Delete a batch job
Delete a batch job. Requires the Owner or Developer role. Returns 404 if the job doesn't exist.
Example
import notehub_py
from notehub_py.models.delete_job200_response import DeleteJob200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
job_uid = (
"my-reconciliation-job" # str | Batch job UID, as returned by `CreateJob`.
)
try:
# Delete a batch job
api_response = api_instance.delete_job(project_or_product_uid, job_uid)
print("The response of JobsApi->delete_job:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->delete_job: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| job_uid | str | Batch job UID, as returned by `CreateJob`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_job_run
delete_job_run(project_or_product_uid, report_uid)
Delete a job run
Delete a job run and its results. Deleting a run that doesn't exist also succeeds. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
report_uid = "my-reconciliation-job-1707654321000" # str | Job run UID, as returned by `RunJob`.
try:
# Delete a job run
api_instance.delete_job_run(project_or_product_uid, report_uid)
except Exception as e:
print("Exception when calling JobsApi->delete_job_run: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| report_uid | str | Job run UID, as returned by `RunJob`. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_job
JobDetail get_job(project_or_product_uid, job_uid)
Get a batch job
Get one batch job's definition and its latest run's status. Returns 404 if the job doesn't exist.
Example
import notehub_py
from notehub_py.models.job_detail import JobDetail
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
job_uid = (
"my-reconciliation-job" # str | Batch job UID, as returned by `CreateJob`.
)
try:
# Get a batch job
api_response = api_instance.get_job(project_or_product_uid, job_uid)
print("The response of JobsApi->get_job:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->get_job: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| job_uid | str | Batch job UID, as returned by `CreateJob`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_job_run
JobRun get_job_run(project_or_product_uid, report_uid, view=view)
Get a job run
Get a job run's status and, with view=detail, its full results. Returns 404 if the run doesn't exist.
Example
import notehub_py
from notehub_py.models.job_run import JobRun
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
report_uid = "my-reconciliation-job-1707654321000" # str | Job run UID, as returned by `RunJob`.
view = "summary" # str | Controls the level of detail returned: 'summary' returns metadata only, 'detail' returns the full result payload (optional) (default to 'summary')
try:
# Get a job run
api_response = api_instance.get_job_run(
project_or_product_uid, report_uid, view=view
)
print("The response of JobsApi->get_job_run:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->get_job_run: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| report_uid | str | Job run UID, as returned by `RunJob`. | |
| view | str | Controls the level of detail returned: 'summary' returns metadata only, 'detail' returns the full result payload | [optional] [default to 'summary'] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_job_runs
GetJobRuns200Response get_job_runs(project_or_product_uid, job_uid, status=status, dry_run=dry_run)
List a job's runs
List a batch job's runs, optionally filtered by status or dry-run flag. Returns 404 if the job doesn't exist.
Example
import notehub_py
from notehub_py.models.get_job_runs200_response import GetJobRuns200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
job_uid = (
"my-reconciliation-job" # str | Batch job UID, as returned by `CreateJob`.
)
status = "status_example" # str | Return only runs with this status. (optional)
dry_run = True # bool | If set, return only dry runs (`true`) or only real runs (`false`). (optional)
try:
# List a job's runs
api_response = api_instance.get_job_runs(
project_or_product_uid, job_uid, status=status, dry_run=dry_run
)
print("The response of JobsApi->get_job_runs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->get_job_runs: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| job_uid | str | Batch job UID, as returned by `CreateJob`. | |
| status | str | Return only runs with this status. | [optional] |
| dry_run | bool | If set, return only dry runs (`true`) or only real runs (`false`). | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_jobs
GetJobs200Response get_jobs(project_or_product_uid)
List batch jobs
List a project's batch jobs with their latest run's status. A batch job applies changes, such as environment variables, to a selected set of devices.
Example
import notehub_py
from notehub_py.models.get_jobs200_response import GetJobs200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List batch jobs
api_response = api_instance.get_jobs(project_or_product_uid)
print("The response of JobsApi->get_jobs:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->get_jobs: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
run_job
RunJob200Response run_job(project_or_product_uid, job_uid, dry_run=dry_run)
Run a batch job
Start a run of a batch job and return its run UID. The run continues in the background, and GetJobRun shows its progress. With dry_run=true, it reports what would change without changing anything. Requires the Owner or Developer role. Returns 404 if the job doesn't exist.
Example
import notehub_py
from notehub_py.models.run_job200_response import RunJob200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.JobsApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
job_uid = (
"my-reconciliation-job" # str | Batch job UID, as returned by `CreateJob`.
)
dry_run = False # bool | If true, report what the job would change without changing anything. (optional) (default to False)
try:
# Run a batch job
api_response = api_instance.run_job(
project_or_product_uid, job_uid, dry_run=dry_run
)
print("The response of JobsApi->run_job:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling JobsApi->run_job: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| job_uid | str | Batch job UID, as returned by `CreateJob`. | |
| dry_run | bool | If true, report what the job would change without changing anything. | [optional] [default to False] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
Monitor API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| create_monitor | POST /v1/projects/{projectOrProductUID}/monitors | Create a monitor |
| delete_monitor | DELETE /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | Delete a monitor |
| get_monitor | GET /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | Get a monitor |
| get_monitors | GET /v1/projects/{projectOrProductUID}/monitors | List monitors |
| update_monitor | PUT /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | Update a monitor |
create_monitor
Monitor create_monitor(project_or_product_uid, create_monitor)
Create a monitor
Create a monitor that raises an alert and notifies email, Slack or Twilio when its condition holds. It can watch an event value (event, the default), devices going quiet (heartbeat), or data usage (usage). Requires the Owner or Developer role. Returns 403 if the project's plan doesn't allow the monitor, and 400 for invalid settings.
Example
import notehub_py
from notehub_py.models.create_monitor import CreateMonitor
from notehub_py.models.monitor import Monitor
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.MonitorApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
create_monitor = (
notehub_py.CreateMonitor()
) # CreateMonitor | Body or payload of monitor to be created
try:
# Create a monitor
api_response = api_instance.create_monitor(
project_or_product_uid, create_monitor
)
print("The response of MonitorApi->create_monitor:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MonitorApi->create_monitor: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| create_monitor | CreateMonitor | Body or payload of monitor to be created |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
delete_monitor
Monitor delete_monitor(project_or_product_uid, monitor_uid)
Delete a monitor
Delete a monitor so it stops raising alerts. Returns an empty monitor object. To pause it instead, set disabled with UpdateMonitor. Requires the Owner or Developer role. Returns 404 if the monitor never existed; deleting it again succeeds.
Example
import notehub_py
from notehub_py.models.monitor import Monitor
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.MonitorApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
monitor_uid = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad" # str | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
try:
# Delete a monitor
api_response = api_instance.delete_monitor(project_or_product_uid, monitor_uid)
print("The response of MonitorApi->delete_monitor:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MonitorApi->delete_monitor: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| monitor_uid | str | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_monitor
Monitor get_monitor(project_or_product_uid, monitor_uid)
Get a monitor
Get one monitor's settings and whether it's in alert. Slack and Twilio credentials in alert_routes come back as (omitted). Returns 404 if the monitor never existed; a deleted monitor is still returned.
Example
import notehub_py
from notehub_py.models.monitor import Monitor
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.MonitorApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
monitor_uid = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad" # str | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
try:
# Get a monitor
api_response = api_instance.get_monitor(project_or_product_uid, monitor_uid)
print("The response of MonitorApi->get_monitor:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MonitorApi->get_monitor: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| monitor_uid | str | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_monitors
List[Monitor] get_monitors(project_or_product_uid)
List monitors
List a project's monitors with their settings and whether each is in alert. For the alerts they've raised, use GetAlerts.
Example
import notehub_py
from notehub_py.models.monitor import Monitor
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.MonitorApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List monitors
api_response = api_instance.get_monitors(project_or_product_uid)
print("The response of MonitorApi->get_monitors:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MonitorApi->get_monitors: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
update_monitor
Monitor update_monitor(project_or_product_uid, monitor_uid, monitor)
Update a monitor
Replace a monitor's settings with the whole monitor, as GetMonitor returns it. Omitted fields are cleared or reset, except source_type, fleet_filter, notefile_filter, condition_type, aggregate_window and alert_routes. Slack and Twilio credentials left as (omitted) are kept. Requires the Owner or Developer role. Returns 403 if the plan doesn't allow a new source_type.
Example
import notehub_py
from notehub_py.models.monitor import Monitor
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.MonitorApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
monitor_uid = "monitor:8bAdf00d-000f-51c-af-01d5eaf00dbad" # str | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`.
monitor = notehub_py.Monitor() # Monitor | Body or payload of monitor to be created
try:
# Update a monitor
api_response = api_instance.update_monitor(
project_or_product_uid, monitor_uid, monitor
)
print("The response of MonitorApi->update_monitor:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling MonitorApi->update_monitor: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| monitor_uid | str | MonitorUID, `monitor:` followed by a UUID. List with `GetMonitors`. | |
| monitor | Monitor | Body or payload of monitor to be created |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
Organization API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| get_organization | GET /v1/organizations/{organizationUID} | Get an organization |
| get_organization_balance_history | GET /v1/organizations/{organizationUID}/balance-history | Get an organization's daily balance |
| get_organizations | GET /v1/organizations | List your organizations |
get_organization
GetOrganization200Response get_organization(organization_uid)
Get an organization
Get an organization's name, owner, contact email and current plan. The plan has its type, event capacity, billing period and remaining balance. For the daily history, use GetOrganizationBalanceHistory. Requires the org_admin, billing_manager or org_support role in the organization. Returns 403 if your membership is deactivated.
Example
import notehub_py
from notehub_py.models.get_organization200_response import GetOrganization200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.OrganizationApi(api_client)
organization_uid = "00000000-0000-0000-000000000001" # str | Organization UID. List with `GetOrganizations`.
try:
# Get an organization
api_response = api_instance.get_organization(organization_uid)
print("The response of OrganizationApi->get_organization:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling OrganizationApi->get_organization: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| organization_uid | str | Organization UID. List with `GetOrganizations`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_organization_balance_history
GetOrganizationBalanceHistory200Response get_organization_balance_history(organization_uid, start_date=start_date, end_date=end_date)
Get an organization's daily balance
Get an organization's events used and remaining event capacity for each day. The range is startDate to endDate, which default to the start of the billing period and today. Requires the org_admin, billing_manager or org_support role in the organization. Returns 400 if startDate is after endDate.
Example
import notehub_py
from notehub_py.models.get_organization_balance_history200_response import (
GetOrganizationBalanceHistory200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.OrganizationApi(api_client)
organization_uid = "00000000-0000-0000-000000000001" # str | Organization UID. List with `GetOrganizations`.
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
try:
# Get an organization's daily balance
api_response = api_instance.get_organization_balance_history(
organization_uid, start_date=start_date, end_date=end_date
)
print("The response of OrganizationApi->get_organization_balance_history:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling OrganizationApi->get_organization_balance_history: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| organization_uid | str | Organization UID. List with `GetOrganizations`. | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
Return type
GetOrganizationBalanceHistory200Response
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_organizations
GetOrganizations200Response get_organizations()
List your organizations
List the organizations you belong to, with your role in each. A scoped token gets an empty list. Returns 401 if your email address isn't verified.
Example
import notehub_py
from notehub_py.models.get_organizations200_response import GetOrganizations200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.OrganizationApi(api_client)
try:
# List your organizations
api_response = api_instance.get_organizations()
print("The response of OrganizationApi->get_organizations:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling OrganizationApi->get_organizations: %s\n" % e)Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
Project API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| add_device_to_fleets | PUT /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | Add a device to fleets |
| clone_project | POST /v1/projects/{projectOrProductUID}/clone | Clone a project |
| create_fleet | POST /v1/projects/{projectOrProductUID}/fleets | Create a fleet |
| create_product | POST /v1/projects/{projectOrProductUID}/products | Create a product |
| create_project | POST /v1/projects | Create a project |
| create_project_secret | POST /v1/projects/{projectOrProductUID}/secrets | Create a project secret |
| delete_device_from_fleets | DELETE /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | Remove a device from fleets |
| delete_firmware | DELETE /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Delete host firmware |
| delete_fleet | DELETE /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | Delete a fleet |
| delete_fleet_environment_variable | DELETE /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables/{key} | Delete a fleet environment variable |
| delete_product | DELETE /v1/projects/{projectOrProductUID}/products/{productUID} | Delete a product |
| delete_project | DELETE /v1/projects/{projectOrProductUID} | Delete a project |
| delete_project_environment_variable | DELETE /v1/projects/{projectOrProductUID}/environment_variables/{key} | Delete a project environment variable |
| delete_project_secret | DELETE /v1/projects/{projectOrProductUID}/secrets/{secretName} | Delete a project secret |
| disable_global_event_transformation | POST /v1/projects/{projectOrProductUID}/global-transformation/disable | Disable the global event transformation |
| download_firmware | GET /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Download host firmware |
| enable_global_event_transformation | POST /v1/projects/{projectOrProductUID}/global-transformation/enable | Enable the global event transformation |
| get_aws_role_config | GET /v1/projects/{projectOrProductUID}/aws-role-config | Get AWS role configuration for role-based authentication |
| get_device_dfu_history | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/history | Get a device's firmware update history |
| get_device_dfu_status | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/status | Get a device's firmware update status |
| get_device_fleets | GET /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | List a device's fleets |
| get_devices_dfu_history | GET /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/history | List devices' firmware update history |
| get_devices_dfu_status | GET /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/status | List devices' firmware status |
| get_firmware_info | GET /v1/projects/{projectOrProductUID}/firmware | List firmware |
| get_fleet | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | Get a fleet |
| get_fleet_environment_hierarchy | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_hierarchy | Get a fleet's environment hierarchy |
| get_fleet_environment_variables | GET /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables | Get fleet environment variables |
| get_fleets | GET /v1/projects/{projectOrProductUID}/fleets | List fleets |
| get_notefile_schemas | GET /v1/projects/{projectOrProductUID}/schemas | List Notefile schemas |
| get_products | GET /v1/projects/{projectOrProductUID}/products | List a project's products |
| get_project | GET /v1/projects/{projectOrProductUID} | Get a project |
| get_project_by_product | GET /v1/products/{productUID}/project | Get the project for a ProductUID |
| get_project_environment_hierarchy | GET /v1/projects/{projectOrProductUID}/environment_hierarchy | Get the project environment hierarchy |
| get_project_environment_variables | GET /v1/projects/{projectOrProductUID}/environment_variables | Get project environment variables |
| get_project_members | GET /v1/projects/{projectOrProductUID}/members | List project members |
| get_project_secrets | GET /v1/projects/{projectOrProductUID}/secrets | List project secrets |
| get_projects | GET /v1/projects | List projects |
| perform_dfu_action | POST /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/{action} | Start or cancel firmware updates |
| set_fleet_environment_variables | PUT /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables | Set fleet environment variables |
| set_global_event_transformation | POST /v1/projects/{projectOrProductUID}/global-transformation | Set the global event transformation |
| set_project_environment_variables | PUT /v1/projects/{projectOrProductUID}/environment_variables | Set project environment variables |
| update_firmware | POST /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Update host firmware metadata |
| update_fleet | PUT /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | Update a fleet |
| update_project_secret | PUT /v1/projects/{projectOrProductUID}/secrets/{secretName} | Update a project secret |
| upload_firmware | PUT /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | Upload firmware |
add_device_to_fleets
GetDeviceFleets200Response add_device_to_fleets(project_or_product_uid, device_uid, add_device_to_fleets_request)
Add a device to fleets
Add a device to one or more fleets, keeping the fleets it's already in, and return all its fleets. Fleets it's already in are skipped, so a retry is safe. Requires the Owner or Developer role. Returns 400 if a fleet doesn't exist.
Example
import notehub_py
from notehub_py.models.add_device_to_fleets_request import AddDeviceToFleetsRequest
from notehub_py.models.get_device_fleets200_response import GetDeviceFleets200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
add_device_to_fleets_request = (
notehub_py.AddDeviceToFleetsRequest()
) # AddDeviceToFleetsRequest | The fleets to add the device to.
try:
# Add a device to fleets
api_response = api_instance.add_device_to_fleets(
project_or_product_uid, device_uid, add_device_to_fleets_request
)
print("The response of ProjectApi->add_device_to_fleets:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->add_device_to_fleets: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| add_device_to_fleets_request | AddDeviceToFleetsRequest | The fleets to add the device to. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
clone_project
Project clone_project(project_or_product_uid, clone_project_request)
Clone a project
Create a new project as a copy of this one. Settings, environment variables, transformation, fleets, routes and host firmware are copied; devices, products and members aren't. Copied fleets get new FleetUIDs. Requires the Owner role (400 otherwise), a verified email address (401 otherwise), and permission to create projects in the target organization (403 otherwise).
Example
import notehub_py
from notehub_py.models.clone_project_request import CloneProjectRequest
from notehub_py.models.project import Project
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
clone_project_request = (
notehub_py.CloneProjectRequest()
) # CloneProjectRequest | The new project's name and organization, and what to leave out of the copy.
try:
# Clone a project
api_response = api_instance.clone_project(
project_or_product_uid, clone_project_request
)
print("The response of ProjectApi->clone_project:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->clone_project: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| clone_project_request | CloneProjectRequest | The new project's name and organization, and what to leave out of the copy. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
create_fleet
Fleet create_fleet(project_or_product_uid, create_fleet_request)
Create a fleet
Create a fleet in the project. Connectivity assurance is on unless connectivity_assurance.enabled is false. A second call creates another fleet. Requires the Owner or Developer role. Returns 400 if label is missing or empty.
Example
import notehub_py
from notehub_py.models.create_fleet_request import CreateFleetRequest
from notehub_py.models.fleet import Fleet
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
create_fleet_request = (
notehub_py.CreateFleetRequest()
) # CreateFleetRequest | The new fleet's name and settings.
try:
# Create a fleet
api_response = api_instance.create_fleet(
project_or_product_uid, create_fleet_request
)
print("The response of ProjectApi->create_fleet:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->create_fleet: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| create_fleet_request | CreateFleetRequest | The new fleet's name and settings. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
create_product
Product create_product(project_or_product_uid, create_product_request)
Create a product
Add a ProductUID to the project, formed from the caller's reversed email and product_uid. For jane@acme.com and sensors it is com.acme.jane:sensors. Requires the Owner or Developer role and a verified email address (400 otherwise). Returns 404 if an auto_provision_fleets entry isn't a fleet in this project, and 500 if product_uid is invalid or already taken.
Example
import notehub_py
from notehub_py.models.create_product_request import CreateProductRequest
from notehub_py.models.product import Product
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
create_product_request = (
notehub_py.CreateProductRequest()
) # CreateProductRequest | The new product's UID suffix, name and provisioning settings.
try:
# Create a product
api_response = api_instance.create_product(
project_or_product_uid, create_product_request
)
print("The response of ProjectApi->create_product:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->create_product: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| create_product_request | CreateProductRequest | The new product's UID suffix, name and provisioning settings. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
create_project
Project create_project(create_project_request)
Create a project
Create a project in an organization, with one default fleet, no products, and the caller as its Owner. A second call creates another project. Requires a verified email address (401 otherwise) and permission to create projects in the organization (403 otherwise).
Example
import notehub_py
from notehub_py.models.create_project_request import CreateProjectRequest
from notehub_py.models.project import Project
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
create_project_request = (
notehub_py.CreateProjectRequest()
) # CreateProjectRequest | The new project's name and organization.
try:
# Create a project
api_response = api_instance.create_project(create_project_request)
print("The response of ProjectApi->create_project:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->create_project: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| create_project_request | CreateProjectRequest | The new project's name and organization. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
create_project_secret
ProjectSecret create_project_secret(project_or_product_uid, create_project_secret_request)
Create a project secret
Store a secret value that routes and alerts can reference as [$$name] without exposing it. The value can't be read back. Requires the Owner or Developer role. Returns 409 if the name is taken, and 400 if it's invalid.
Example
import notehub_py
from notehub_py.models.create_project_secret_request import CreateProjectSecretRequest
from notehub_py.models.project_secret import ProjectSecret
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
create_project_secret_request = (
notehub_py.CreateProjectSecretRequest()
) # CreateProjectSecretRequest |
try:
# Create a project secret
api_response = api_instance.create_project_secret(
project_or_product_uid, create_project_secret_request
)
print("The response of ProjectApi->create_project_secret:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->create_project_secret: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| create_project_secret_request | CreateProjectSecretRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
delete_device_from_fleets
GetDeviceFleets200Response delete_device_from_fleets(project_or_product_uid, device_uid, delete_device_from_fleets_request)
Remove a device from fleets
Remove a device from one or more fleets and return the fleets it's still in. Fleets it isn't in are ignored, so a retry is safe. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.models.delete_device_from_fleets_request import (
DeleteDeviceFromFleetsRequest,
)
from notehub_py.models.get_device_fleets200_response import GetDeviceFleets200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
delete_device_from_fleets_request = (
notehub_py.DeleteDeviceFromFleetsRequest()
) # DeleteDeviceFromFleetsRequest | The fleets to remove the device from.
try:
# Remove a device from fleets
api_response = api_instance.delete_device_from_fleets(
project_or_product_uid, device_uid, delete_device_from_fleets_request
)
print("The response of ProjectApi->delete_device_from_fleets:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->delete_device_from_fleets: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| delete_device_from_fleets_request | DeleteDeviceFromFleetsRequest | The fleets to remove the device from. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
delete_firmware
delete_firmware(project_or_product_uid, firmware_type, filename)
Delete host firmware
Delete a host firmware file by its stored filename, including its $ timestamp suffix. Notecard firmware can't be deleted. Requires the Owner or Developer role. Returns 404 if the file doesn't exist, and 400 for a sub-project, whose parent manages host firmware.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str |
filename = "filename_example" # str |
try:
# Delete host firmware
api_instance.delete_firmware(project_or_product_uid, firmware_type, filename)
except Exception as e:
print("Exception when calling ProjectApi->delete_firmware: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | ||
| filename | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_fleet
delete_fleet(project_or_product_uid, fleet_uid)
Delete a fleet
Delete a fleet and remove it from all its devices. The devices stay in the project; the fleet's environment variables are deleted. To remove one device from a fleet, use DeleteDeviceFromFleets. Requires the Owner or Developer role. Returns 400 if the fleet does not exist, including on a retry.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
try:
# Delete a fleet
api_instance.delete_fleet(project_or_product_uid, fleet_uid)
except Exception as e:
print("Exception when calling ProjectApi->delete_fleet: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_fleet_environment_variable
EnvironmentVariables delete_fleet_environment_variable(project_or_product_uid, fleet_uid, key)
Delete a fleet environment variable
Delete one fleet environment variable and return the ones left. Requires the Owner or Developer role. Returns 404 if the fleet or the variable doesn't exist.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
key = "key_example" # str | Name of the environment variable to delete.
try:
# Delete a fleet environment variable
api_response = api_instance.delete_fleet_environment_variable(
project_or_product_uid, fleet_uid, key
)
print("The response of ProjectApi->delete_fleet_environment_variable:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->delete_fleet_environment_variable: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str | ||
| key | str | Name of the environment variable to delete. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_product
delete_product(project_or_product_uid, product_uid)
Delete a product
Remove a ProductUID from the project. Accepts the UID with or without the product: prefix. Requires the Owner or Developer role. Returns 404 if the project has no such ProductUID.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
product_uid = "com.blues.bridge:sensors" # str |
try:
# Delete a product
api_instance.delete_product(project_or_product_uid, product_uid)
except Exception as e:
print("Exception when calling ProjectApi->delete_product: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| product_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_project
delete_project(project_or_product_uid)
Delete a project
Delete a project, its ProductUIDs, and every member's access to it. Can't be undone through the API. Requires the Owner or Developer role. Returns 200 with no body.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Delete a project
api_instance.delete_project(project_or_product_uid)
except Exception as e:
print("Exception when calling ProjectApi->delete_project: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_project_environment_variable
EnvironmentVariables delete_project_environment_variable(project_or_product_uid, key)
Delete a project environment variable
Delete one project environment variable and return the ones left. Deleting a variable that doesn't exist still succeeds. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
key = "key_example" # str | Name of the environment variable to delete.
try:
# Delete a project environment variable
api_response = api_instance.delete_project_environment_variable(
project_or_product_uid, key
)
print("The response of ProjectApi->delete_project_environment_variable:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->delete_project_environment_variable: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| key | str | Name of the environment variable to delete. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete_project_secret
delete_project_secret(project_or_product_uid, secret_name)
Delete a project secret
Delete a project secret. Routes and alerts that still reference it can no longer resolve it. Requires the Owner or Developer role. Returns 404 if the secret doesn't exist.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
secret_name = "secret_name_example" # str | Name of the secret, as listed by `GetProjectSecrets`.
try:
# Delete a project secret
api_instance.delete_project_secret(project_or_product_uid, secret_name)
except Exception as e:
print("Exception when calling ProjectApi->delete_project_secret: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| secret_name | str | Name of the secret, as listed by `GetProjectSecrets`. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
disable_global_event_transformation
disable_global_event_transformation(project_or_product_uid)
Disable the global event transformation
Stop applying the project's global event transformation to new events. The expression is kept, so EnableGlobalEventTransformation can turn it back on. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent's transformation applies.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Disable the global event transformation
api_instance.disable_global_event_transformation(project_or_product_uid)
except Exception as e:
print(
"Exception when calling ProjectApi->disable_global_event_transformation: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
download_firmware
bytearray download_firmware(project_or_product_uid, firmware_type, filename)
Download host firmware
Download a host firmware binary by its stored filename, including its $ timestamp suffix. Notecard firmware can't be downloaded (400). Requires the Owner or Developer role. Returns 404 if the file doesn't exist.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
filename = "filename_example" # str |
try:
# Download host firmware
api_response = api_instance.download_firmware(
project_or_product_uid, firmware_type, filename
)
print("The response of ProjectApi->download_firmware:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->download_firmware: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| filename | str |
Return type
bytearray
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/octet-stream, application/json
enable_global_event_transformation
enable_global_event_transformation(project_or_product_uid)
Enable the global event transformation
Resume applying the project's global event transformation to new events, without changing the expression. Undoes DisableGlobalEventTransformation. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent's transformation applies.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Enable the global event transformation
api_instance.enable_global_event_transformation(project_or_product_uid)
except Exception as e:
print(
"Exception when calling ProjectApi->enable_global_event_transformation: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_aws_role_config
AWSRoleConfig get_aws_role_config(project_or_product_uid)
Get AWS role configuration for role-based authentication
Get the AWS account ID and External ID for the IAM role trust policy used by AWS routes with role-based authentication. The External ID is created on the first call and stays the same after that.
Example
import notehub_py
from notehub_py.models.aws_role_config import AWSRoleConfig
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Get AWS role configuration for role-based authentication
api_response = api_instance.get_aws_role_config(project_or_product_uid)
print("The response of ProjectApi->get_aws_role_config:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_aws_role_config: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_dfu_history
DeviceDfuHistory get_device_dfu_history(project_or_product_uid, device_uid, firmware_type)
Get a device's firmware update history
Get a device's current host or Notecard firmware version and every firmware update requested for it, newest first. For just the latest update, use GetDeviceDfuStatus. Returns 400 if the device isn't in the project.
Example
import notehub_py
from notehub_py.models.device_dfu_history import DeviceDfuHistory
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
try:
# Get a device's firmware update history
api_response = api_instance.get_device_dfu_history(
project_or_product_uid, device_uid, firmware_type
)
print("The response of ProjectApi->get_device_dfu_history:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_device_dfu_history: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_dfu_status
DeviceDfuStatus get_device_dfu_status(project_or_product_uid, device_uid, firmware_type)
Get a device's firmware update status
Get a device's current host or Notecard firmware version and its latest firmware update. Includes whether an update is in progress. For every past update, use GetDeviceDfuHistory. Returns 400 if the device isn't in the project.
Example
import notehub_py
from notehub_py.models.device_dfu_status import DeviceDfuStatus
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
try:
# Get a device's firmware update status
api_response = api_instance.get_device_dfu_status(
project_or_product_uid, device_uid, firmware_type
)
print("The response of ProjectApi->get_device_dfu_status:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_device_dfu_status: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_device_fleets
GetDeviceFleets200Response get_device_fleets(project_or_product_uid, device_uid)
List a device's fleets
List the fleets a device belongs to, with only each fleet's UID, label and creation time. For a fleet's full details use GetFleet. Returns 404 if the device isn't in the project.
Example
import notehub_py
from notehub_py.models.get_device_fleets200_response import GetDeviceFleets200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
device_uid = "dev:000000000000000" # str |
try:
# List a device's fleets
api_response = api_instance.get_device_fleets(
project_or_product_uid, device_uid
)
print("The response of ProjectApi->get_device_fleets:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_device_fleets: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| device_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_devices_dfu_history
DeviceDfuHistoryPage get_devices_dfu_history(project_or_product_uid, firmware_type, page_size=page_size, page_num=page_num, cursor=cursor, sort_by=sort_by, sort_order=sort_order, device_uid=device_uid, tag=tag, serial_number=serial_number, fleet_uid=fleet_uid, notecard_firmware=notecard_firmware, location=location, host_firmware=host_firmware, product_uid=product_uid, sku=sku)
List devices' firmware update history
List every host or Notecard firmware update requested for each matching device, newest first. Includes each device's current firmware version. For just the latest update, use GetDevicesDfuStatus. Paginated, by page or cursor. With a cursor, changes made through fleet or project firmware settings don't appear until the device itself is next updated.
Example
import notehub_py
from notehub_py.models.device_dfu_history_page import DeviceDfuHistoryPage
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
sort_by = "captured" # str | (optional) (default to 'captured')
sort_order = "asc" # str | (optional) (default to 'asc')
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
tag = [
"tag_example"
] # List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`. (optional)
serial_number = [
"serial_number_example"
] # List[str] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
fleet_uid = "fleet_uid_example" # str | (optional)
notecard_firmware = [
"notecard_firmware_example"
] # List[str] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
location = [
"location_example"
] # List[str] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
host_firmware = [
"host_firmware_example"
] # List[str] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
product_uid = [
"product_uid_example"
] # List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
sku = [
"sku_example"
] # List[str] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
try:
# List devices' firmware update history
api_response = api_instance.get_devices_dfu_history(
project_or_product_uid,
firmware_type,
page_size=page_size,
page_num=page_num,
cursor=cursor,
sort_by=sort_by,
sort_order=sort_order,
device_uid=device_uid,
tag=tag,
serial_number=serial_number,
fleet_uid=fleet_uid,
notecard_firmware=notecard_firmware,
location=location,
host_firmware=host_firmware,
product_uid=product_uid,
sku=sku,
)
print("The response of ProjectApi->get_devices_dfu_history:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_devices_dfu_history: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| sort_by | str | [optional] [default to 'captured'] | |
| sort_order | str | [optional] [default to 'asc'] | |
| device_uid | List[str] | A DeviceUID. | [optional] |
| tag | List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serial_number | List[str] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleet_uid | str | [optional] | |
| notecard_firmware | List[str] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | List[str] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| host_firmware | List[str] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| product_uid | List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | List[str] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_devices_dfu_status
DeviceDfuStatusPage get_devices_dfu_status(project_or_product_uid, firmware_type, page_size=page_size, page_num=page_num, cursor=cursor, sort_by=sort_by, sort_order=sort_order, device_uid=device_uid, tag=tag, serial_number=serial_number, fleet_uid=fleet_uid, notecard_firmware=notecard_firmware, location=location, host_firmware=host_firmware, product_uid=product_uid, sku=sku)
List devices' firmware status
List the host or Notecard firmware version each matching device runs now, with its latest firmware update. Use this to find which firmware devices run. Paginated, by page or cursor. With a cursor, changes made through fleet or project firmware settings don't appear until the device itself is next updated.
Example
import notehub_py
from notehub_py.models.device_dfu_status_page import DeviceDfuStatusPage
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = "cursor_example" # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
sort_by = "captured" # str | (optional) (default to 'captured')
sort_order = "asc" # str | (optional) (default to 'asc')
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
tag = [
"tag_example"
] # List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`. (optional)
serial_number = [
"serial_number_example"
] # List[str] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
fleet_uid = "fleet_uid_example" # str | (optional)
notecard_firmware = [
"notecard_firmware_example"
] # List[str] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
location = [
"location_example"
] # List[str] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
host_firmware = [
"host_firmware_example"
] # List[str] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
product_uid = [
"product_uid_example"
] # List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
sku = [
"sku_example"
] # List[str] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
try:
# List devices' firmware status
api_response = api_instance.get_devices_dfu_status(
project_or_product_uid,
firmware_type,
page_size=page_size,
page_num=page_num,
cursor=cursor,
sort_by=sort_by,
sort_order=sort_order,
device_uid=device_uid,
tag=tag,
serial_number=serial_number,
fleet_uid=fleet_uid,
notecard_firmware=notecard_firmware,
location=location,
host_firmware=host_firmware,
product_uid=product_uid,
sku=sku,
)
print("The response of ProjectApi->get_devices_dfu_status:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_devices_dfu_status: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| sort_by | str | [optional] [default to 'captured'] | |
| sort_order | str | [optional] [default to 'asc'] | |
| device_uid | List[str] | A DeviceUID. | [optional] |
| tag | List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serial_number | List[str] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleet_uid | str | [optional] | |
| notecard_firmware | List[str] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | List[str] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| host_firmware | List[str] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| product_uid | List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | List[str] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_firmware_info
List[FirmwareInfo] get_firmware_info(project_or_product_uid, product=product, firmware_type=firmware_type, version=version, target=target, filename=filename, md5=md5, unpublished=unpublished, sort_by=sort_by, sort_order=sort_order)
List firmware
List the host firmware uploaded to the project and the Notecard firmware available to it. Text filters match substrings, and unpublished Notecard builds are left out unless unpublished is true. Not paginated.
Example
import notehub_py
from notehub_py.models.firmware_info import FirmwareInfo
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
product = "product_example" # str | Only firmware whose product contains this text. (optional)
firmware_type = "firmware_type_example" # str | Only list `host` or `notecard` firmware. Omit for both. (optional)
version = "version_example" # str | Only firmware whose version contains this text. (optional)
target = "target_example" # str | Only firmware whose target contains this text. (optional)
filename = "notecard-7.2.2.16518$20240410043100.bin" # str | Only firmware whose stored filename contains this text. (optional)
md5 = "md5_example" # str | Only firmware whose MD5 hash contains this text. (optional)
unpublished = (
True # bool | If `true`, also list unpublished Notecard firmware. (optional)
)
sort_by = "created" # str | Field to sort by (optional) (default to 'created')
sort_order = "desc" # str | Sort order (asc for ascending, desc for descending) (optional) (default to 'desc')
try:
# List firmware
api_response = api_instance.get_firmware_info(
project_or_product_uid,
product=product,
firmware_type=firmware_type,
version=version,
target=target,
filename=filename,
md5=md5,
unpublished=unpublished,
sort_by=sort_by,
sort_order=sort_order,
)
print("The response of ProjectApi->get_firmware_info:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_firmware_info: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| product | str | Only firmware whose product contains this text. | [optional] |
| firmware_type | str | Only list `host` or `notecard` firmware. Omit for both. | [optional] |
| version | str | Only firmware whose version contains this text. | [optional] |
| target | str | Only firmware whose target contains this text. | [optional] |
| filename | str | Only firmware whose stored filename contains this text. | [optional] |
| md5 | str | Only firmware whose MD5 hash contains this text. | [optional] |
| unpublished | bool | If `true`, also list unpublished Notecard firmware. | [optional] |
| sort_by | str | Field to sort by | [optional] [default to 'created'] |
| sort_order | str | Sort order (asc for ascending, desc for descending) | [optional] [default to 'desc'] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_fleet
Fleet get_fleet(project_or_product_uid, fleet_uid)
Get a fleet
Get one fleet's label, smart rule, watchdog and environment variables. Doesn't include smart_rule_enabled. Returns 404 if the fleet doesn't exist.
Example
import notehub_py
from notehub_py.models.fleet import Fleet
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
try:
# Get a fleet
api_response = api_instance.get_fleet(project_or_product_uid, fleet_uid)
print("The response of ProjectApi->get_fleet:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_fleet: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_fleet_environment_hierarchy
EnvTreeJsonNode get_fleet_environment_hierarchy(project_or_product_uid, fleet_uid)
Get a fleet's environment hierarchy
Get a fleet's environment variables and the project variables it inherits, as a tree. Each variable has its precedence and whether it is used or overridden. Returns 500 if the fleet doesn't exist.
Example
import notehub_py
from notehub_py.models.env_tree_json_node import EnvTreeJsonNode
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
try:
# Get a fleet's environment hierarchy
api_response = api_instance.get_fleet_environment_hierarchy(
project_or_product_uid, fleet_uid
)
print("The response of ProjectApi->get_fleet_environment_hierarchy:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->get_fleet_environment_hierarchy: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_fleet_environment_variables
EnvironmentVariables get_fleet_environment_variables(project_or_product_uid, fleet_uid)
Get fleet environment variables
Get the environment variables set on a fleet, with their notes. They override project variables, and device variables override them. Returns 404 if the fleet doesn't exist.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
try:
# Get fleet environment variables
api_response = api_instance.get_fleet_environment_variables(
project_or_product_uid, fleet_uid
)
print("The response of ProjectApi->get_fleet_environment_variables:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->get_fleet_environment_variables: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_fleets
GetDeviceFleets200Response get_fleets(project_or_product_uid)
List fleets
List the project's fleets with each one's label, smart rule, watchdog and environment variables. Doesn't include smart_rule_enabled. Not paginated.
Example
import notehub_py
from notehub_py.models.get_device_fleets200_response import GetDeviceFleets200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List fleets
api_response = api_instance.get_fleets(project_or_product_uid)
print("The response of ProjectApi->get_fleets:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_fleets: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_notefile_schemas
List[NotefileSchema] get_notefile_schemas(project_or_product_uid)
List Notefile schemas
List the project's Notefiles, each with the event body fields Notehub has seen in it and their JSON types. Inferred from received events.
Example
import notehub_py
from notehub_py.models.notefile_schema import NotefileSchema
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List Notefile schemas
api_response = api_instance.get_notefile_schemas(project_or_product_uid)
print("The response of ProjectApi->get_notefile_schemas:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_notefile_schemas: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_products
GetProducts200Response get_products(project_or_product_uid)
List a project's products
List the project's ProductUIDs, each with its label, auto-provision fleets, and whether new devices start disabled. UIDs here include the product: prefix; CreateProduct returns them without it. Not paginated.
Example
import notehub_py
from notehub_py.models.get_products200_response import GetProducts200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List a project's products
api_response = api_instance.get_products(project_or_product_uid)
print("The response of ProjectApi->get_products:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_products: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_project
Project get_project(project_or_product_uid)
Get a project
Get a project's label, creation time, contacts, and the caller's role in it. Accepts a ProductUID in place of the ProjectUID.
Example
import notehub_py
from notehub_py.models.project import Project
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Get a project
api_response = api_instance.get_project(project_or_product_uid)
print("The response of ProjectApi->get_project:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_project: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_project_by_product
Project get_project_by_product(product_uid)
Get the project for a ProductUID
Get the project that a ProductUID belongs to. Returns the same object as GetProject, which also accepts a ProductUID in place of a ProjectUID.
Example
import notehub_py
from notehub_py.models.project import Project
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
product_uid = "com.blues.airnote" # str | ProductUID, e.g. `com.blues.airnote`, with or without the `product:` prefix.
try:
# Get the project for a ProductUID
api_response = api_instance.get_project_by_product(product_uid)
print("The response of ProjectApi->get_project_by_product:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_project_by_product: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| product_uid | str | ProductUID, e.g. `com.blues.airnote`, with or without the `product:` prefix. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_project_environment_hierarchy
EnvTreeJsonNode get_project_environment_hierarchy(project_or_product_uid)
Get the project environment hierarchy
Get the project's environment variables as a one-node environment hierarchy tree. The fleet and device hierarchy operations use the same format; for plain key/value pairs, use GetProjectEnvironmentVariables.
Example
import notehub_py
from notehub_py.models.env_tree_json_node import EnvTreeJsonNode
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Get the project environment hierarchy
api_response = api_instance.get_project_environment_hierarchy(
project_or_product_uid
)
print("The response of ProjectApi->get_project_environment_hierarchy:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->get_project_environment_hierarchy: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_project_environment_variables
EnvironmentVariables get_project_environment_variables(project_or_product_uid)
Get project environment variables
Get the environment variables set on the project, with their notes. Fleet and device variables override these; for what a device actually sees, use GetDeviceEnvironmentVariables.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# Get project environment variables
api_response = api_instance.get_project_environment_variables(
project_or_product_uid
)
print("The response of ProjectApi->get_project_environment_variables:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->get_project_environment_variables: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_project_members
GetProjectMembers200Response get_project_members(project_or_product_uid)
List project members
List the project's members with each one's name and role. Emails are filled in only when the caller is an Owner. Not paginated.
Example
import notehub_py
from notehub_py.models.get_project_members200_response import (
GetProjectMembers200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List project members
api_response = api_instance.get_project_members(project_or_product_uid)
print("The response of ProjectApi->get_project_members:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_project_members: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_project_secrets
GetProjectSecretsResponse get_project_secrets(project_or_product_uid)
List project secrets
List the project's secrets by name, with who created and last changed each one and when. Values are never returned.
Example
import notehub_py
from notehub_py.models.get_project_secrets_response import GetProjectSecretsResponse
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
# List project secrets
api_response = api_instance.get_project_secrets(project_or_product_uid)
print("The response of ProjectApi->get_project_secrets:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_project_secrets: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_projects
GetProjects200Response get_projects()
List projects
List every project the caller is a member of, with the caller's role in each. Not paginated.
Example
import notehub_py
from notehub_py.models.get_projects200_response import GetProjects200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
try:
# List projects
api_response = api_instance.get_projects()
print("The response of ProjectApi->get_projects:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->get_projects: %s\n" % e)Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
perform_dfu_action
perform_dfu_action(project_or_product_uid, firmware_type, action, device_uid=device_uid, tag=tag, serial_number=serial_number, fleet_uid=fleet_uid, notecard_firmware=notecard_firmware, location=location, host_firmware=host_firmware, product_uid=product_uid, sku=sku, dfu_action_request=dfu_action_request)
Start or cancel firmware updates
Start or cancel a host or Notecard firmware update on every device matching the filters. With no filters, that is every device in the project. update sets each device's _fw or _fwc variable to filename. Requires the Owner or Developer role. update returns 404 if the file isn't found, and can return 400 if a matching device already has an update in progress.
Example
import notehub_py
from notehub_py.models.dfu_action_request import DfuActionRequest
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
action = "action_example" # str | - `update`: start updating to the firmware in `filename` - `cancel`: cancel any update in progress
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
tag = [
"tag_example"
] # List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. For example, `51*` matches tags starting with `51`. (optional)
serial_number = [
"serial_number_example"
] # List[str] | Serial number filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
fleet_uid = "fleet_uid_example" # str | (optional)
notecard_firmware = [
"notecard_firmware_example"
] # List[str] | Firmware version filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
location = [
"location_example"
] # List[str] | Location filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
host_firmware = [
"host_firmware_example"
] # List[str] | Host firmware filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
product_uid = [
"product_uid_example"
] # List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
sku = [
"sku_example"
] # List[str] | SKU filter. Matches any value containing the filter text. Use `*` as a wildcard and `\\*` to match a literal `*`; all other characters, including `%` and `_`, match literally. (optional)
dfu_action_request = (
notehub_py.DfuActionRequest()
) # DfuActionRequest | Which firmware in the case of an update action (optional)
try:
# Start or cancel firmware updates
api_instance.perform_dfu_action(
project_or_product_uid,
firmware_type,
action,
device_uid=device_uid,
tag=tag,
serial_number=serial_number,
fleet_uid=fleet_uid,
notecard_firmware=notecard_firmware,
location=location,
host_firmware=host_firmware,
product_uid=product_uid,
sku=sku,
dfu_action_request=dfu_action_request,
)
except Exception as e:
print("Exception when calling ProjectApi->perform_dfu_action: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| action | str | - `update`: start updating to the firmware in `filename` - `cancel`: cancel any update in progress | |
| device_uid | List[str] | A DeviceUID. | [optional] |
| tag | List[str] | Tag filter. Matches the whole tag, case-insensitive. Use `` as a wildcard and `\` to match a literal ``; all other characters, including `%` and `_`, match literally. For example, `51` matches tags starting with `51`. | [optional] |
| serial_number | List[str] | Serial number filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| fleet_uid | str | [optional] | |
| notecard_firmware | List[str] | Firmware version filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| location | List[str] | Location filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| host_firmware | List[str] | Host firmware filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| product_uid | List[str] | ProductUID filter. Matches any value containing the filter text, case-insensitive. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| sku | List[str] | SKU filter. Matches any value containing the filter text. Use `` as a wildcard and `\` to match a literal `*`; all other characters, including `%` and `_`, match literally. | [optional] |
| dfu_action_request | DfuActionRequest | Which firmware in the case of an update action | [optional] |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
set_fleet_environment_variables
EnvironmentVariables set_fleet_environment_variables(project_or_product_uid, fleet_uid, environment_variables)
Set fleet environment variables
Add or change a fleet's environment variables; variables you don't send keep their values. A value of \"\" or - deletes that variable. Setting _fw, _fwc or _fwm starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 404 if the fleet doesn't exist, and 400 if a note's key isn't a variable.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
environment_variables = (
notehub_py.EnvironmentVariables()
) # EnvironmentVariables | The variables to add or change, and optional notes.
try:
# Set fleet environment variables
api_response = api_instance.set_fleet_environment_variables(
project_or_product_uid, fleet_uid, environment_variables
)
print("The response of ProjectApi->set_fleet_environment_variables:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->set_fleet_environment_variables: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str | ||
| environment_variables | EnvironmentVariables | The variables to add or change, and optional notes. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
set_global_event_transformation
set_global_event_transformation(project_or_product_uid, body)
Set the global event transformation
Set the project's JSONata expression that rewrites each new event before it's stored and routed. It can change body, payload, details, file and note, or drop the event with $doNotRoute(); an event it fails on is kept with error set. Doesn't enable or disable it. Requires the Owner or Developer role. Returns 400 if it doesn't compile, or for a sub-project, which uses its parent's.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
body = "body_example" # str | JSONata expression as plain text. An empty body clears the transformation.
try:
# Set the global event transformation
api_instance.set_global_event_transformation(project_or_product_uid, body)
except Exception as e:
print(
"Exception when calling ProjectApi->set_global_event_transformation: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| body | str | JSONata expression as plain text. An empty body clears the transformation. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: text/plain
- Accept: application/json
set_project_environment_variables
EnvironmentVariables set_project_environment_variables(project_or_product_uid, environment_variables=environment_variables)
Set project environment variables
Add or change project environment variables; variables you don't send keep their values. A value of \"\" or - deletes that variable. Setting _fw, _fwc or _fwm starts a host, Notecard or modem firmware update. Requires the Owner or Developer role. Returns 400 if a note's key isn't a variable.
Example
import notehub_py
from notehub_py.models.environment_variables import EnvironmentVariables
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
environment_variables = (
notehub_py.EnvironmentVariables()
) # EnvironmentVariables | (optional)
try:
# Set project environment variables
api_response = api_instance.set_project_environment_variables(
project_or_product_uid, environment_variables=environment_variables
)
print("The response of ProjectApi->set_project_environment_variables:\n")
pprint(api_response)
except Exception as e:
print(
"Exception when calling ProjectApi->set_project_environment_variables: %s\n"
% e
)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| environment_variables | EnvironmentVariables | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
update_firmware
FirmwareInfo update_firmware(project_or_product_uid, firmware_type, filename, update_host_firmware_request)
Update host firmware metadata
Change a host firmware file's version, notes or info; fields you leave out or send empty keep their values. Use the stored filename, including its $ timestamp suffix. Requires the Owner or Developer role. Returns 400 for a sub-project, whose parent manages host firmware, and 404 if the file doesn't exist.
Example
import notehub_py
from notehub_py.models.firmware_info import FirmwareInfo
from notehub_py.models.update_host_firmware_request import UpdateHostFirmwareRequest
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str |
filename = "filename_example" # str |
update_host_firmware_request = (
notehub_py.UpdateHostFirmwareRequest()
) # UpdateHostFirmwareRequest | Firmware metadata fields to update. All fields are optional; only provided fields will be updated.
try:
# Update host firmware metadata
api_response = api_instance.update_firmware(
project_or_product_uid,
firmware_type,
filename,
update_host_firmware_request,
)
print("The response of ProjectApi->update_firmware:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->update_firmware: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | ||
| filename | str | ||
| update_host_firmware_request | UpdateHostFirmwareRequest | Firmware metadata fields to update. All fields are optional; only provided fields will be updated. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
update_fleet
Fleet update_fleet(project_or_product_uid, fleet_uid, update_fleet_request)
Update a fleet
Change a fleet's label, smart rule, watchdog or connectivity assurance, or add and remove devices. Always send smart_rule_enabled; leaving it out turns the smart rule off. Empty label or smart_rule keeps the current value; - clears smart_rule. Requires the Owner or Developer role. Returns 400 for an unknown fleet or label of -, and for a bad DeviceUID after saving the other changes.
Example
import notehub_py
from notehub_py.models.fleet import Fleet
from notehub_py.models.update_fleet_request import UpdateFleetRequest
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
fleet_uid = "fleet_uid_example" # str |
update_fleet_request = (
notehub_py.UpdateFleetRequest()
) # UpdateFleetRequest | The fields to change. Fields left out keep their values, except `smart_rule_enabled`.
try:
# Update a fleet
api_response = api_instance.update_fleet(
project_or_product_uid, fleet_uid, update_fleet_request
)
print("The response of ProjectApi->update_fleet:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->update_fleet: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| fleet_uid | str | ||
| update_fleet_request | UpdateFleetRequest | The fields to change. Fields left out keep their values, except `smart_rule_enabled`. |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
update_project_secret
ProjectSecret update_project_secret(project_or_product_uid, secret_name, update_project_secret_request)
Update a project secret
Replace the value of an existing project secret. Routes and alerts that reference it use the new value from then on. Requires the Owner or Developer role. Returns 404 if the secret doesn't exist.
Example
import notehub_py
from notehub_py.models.project_secret import ProjectSecret
from notehub_py.models.update_project_secret_request import UpdateProjectSecretRequest
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
secret_name = "secret_name_example" # str | Name of the secret, as listed by `GetProjectSecrets`.
update_project_secret_request = (
notehub_py.UpdateProjectSecretRequest()
) # UpdateProjectSecretRequest |
try:
# Update a project secret
api_response = api_instance.update_project_secret(
project_or_product_uid, secret_name, update_project_secret_request
)
print("The response of ProjectApi->update_project_secret:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->update_project_secret: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| secret_name | str | Name of the secret, as listed by `GetProjectSecrets`. | |
| update_project_secret_request | UpdateProjectSecretRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
upload_firmware
FirmwareInfo upload_firmware(project_or_product_uid, firmware_type, filename, body, version=version, notes=notes)
Upload firmware
Upload a host or Notecard firmware binary. Notehub usually adds a timestamp to filename; use the returned filename from then on. Requires the Owner or Developer role. Returns 400 for host firmware on a sub-project, whose parent manages it, and 500 for a wrong file type or a file over the limit: 1.5 MB for host firmware, 2 MB for notecard-s3-* and 1 MB for other Notecard firmware.
Example
import notehub_py
from notehub_py.models.firmware_info import FirmwareInfo
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.ProjectApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
firmware_type = "firmware_type_example" # str | Which firmware: `host` (the host microcontroller's) or `notecard`.
filename = "filename_example" # str | Name to store the file under. Notehub adds `$` and a timestamp before the extension, except for a Notecard firmware name that already contains `$`.
body = None # bytearray | contents of the firmware binary
version = "version_example" # str | Firmware version (optional). If not provided, the version will be extracted from firmware binary if available, otherwise left empty (optional)
notes = "notes_example" # str | Optional notes describing what's different about this firmware version (optional)
try:
# Upload firmware
api_response = api_instance.upload_firmware(
project_or_product_uid,
firmware_type,
filename,
body,
version=version,
notes=notes,
)
print("The response of ProjectApi->upload_firmware:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ProjectApi->upload_firmware: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| firmware_type | str | Which firmware: `host` (the host microcontroller's) or `notecard`. | |
| filename | str | Name to store the file under. Notehub adds `$` and a timestamp before the extension, except for a Notecard firmware name that already contains `$`. | |
| body | bytearray | contents of the firmware binary | |
| version | str | Firmware version (optional). If not provided, the version will be extracted from firmware binary if available, otherwise left empty | [optional] |
| notes | str | Optional notes describing what's different about this firmware version | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: application/octet-stream
- Accept: application/json
Route API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| create_route | POST /v1/projects/{projectOrProductUID}/routes | Create a route |
| delete_route | DELETE /v1/projects/{projectOrProductUID}/routes/{routeUID} | Delete a route |
| get_route | GET /v1/projects/{projectOrProductUID}/routes/{routeUID} | Get a route |
| get_route_logs_by_route | GET /v1/projects/{projectOrProductUID}/routes/{routeUID}/route-logs | List a route's logs |
| get_routes | GET /v1/projects/{projectOrProductUID}/routes | List routes |
| update_route | PUT /v1/projects/{projectOrProductUID}/routes/{routeUID} | Update a route |
create_route
NotehubRoute create_route(project_or_product_uid, notehub_route)
Create a route
Create a route that sends a project's events to a destination such as a URL, an MQTT broker or a cloud service. Set type and fill in the object it names. Omit fleets to send every fleet's events. Unknown FleetUIDs are ignored, so fleets: [] or a list of only unknown UIDs gives a route that sends nothing. Requires the Owner or Developer role. Returns 400 for invalid settings.
Example
import notehub_py
from notehub_py.models.notehub_route import NotehubRoute
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "PERSONAL_ACCESS_TOKEN"
)
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.RouteApi(api_client)
project_or_product_uid = 'app:2606f411-dea6-44a0-9743-1130f57d77d8' # str |
notehub_route = {"http":{"disable_http_headers":false,"filter":{},"fleets":["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],"http_headers":{"X-My-Header":"value"},"throttle_ms":100,"timeout":5000,"transform":{},"url":"https://example.com/ingest"},"label":"Route Label"} # NotehubRoute | Route to be created
try:
# Create a route
api_response = api_instance.create_route(project_or_product_uid, notehub_route)
print("The response of RouteApi->create_route:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RouteApi->create_route: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| notehub_route | NotehubRoute | Route to be created |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
delete_route
delete_route(project_or_product_uid, route_uid)
Delete a route
Delete a route so it stops sending events. To pause it instead, set disabled with UpdateRoute. Requires the Owner or Developer role.
Example
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "PERSONAL_ACCESS_TOKEN"
)
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.RouteApi(api_client)
project_or_product_uid = 'app:2606f411-dea6-44a0-9743-1130f57d77d8' # str |
route_uid = 'route:cbd20093cba58392c9f9bbdd0cdeb1a0' # str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
try:
# Delete a route
api_instance.delete_route(project_or_product_uid, route_uid)
except Exception as e:
print("Exception when calling RouteApi->delete_route: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| route_uid | str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_route
NotehubRoute get_route(project_or_product_uid, route_uid)
Get a route
Get one route's full settings: destination, filter, transform and fleets. Secrets such as passwords and keys come back as (omitted). Requires the Owner or Developer role. Viewers can use GetRoutes. Returns 404 if the route doesn't exist.
Example
import notehub_py
from notehub_py.models.notehub_route import NotehubRoute
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "PERSONAL_ACCESS_TOKEN"
)
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.RouteApi(api_client)
project_or_product_uid = 'app:2606f411-dea6-44a0-9743-1130f57d77d8' # str |
route_uid = 'route:cbd20093cba58392c9f9bbdd0cdeb1a0' # str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
try:
# Get a route
api_response = api_instance.get_route(project_or_product_uid, route_uid)
print("The response of RouteApi->get_route:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RouteApi->get_route: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| route_uid | str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_route_logs_by_route
List[RouteLog] get_route_logs_by_route(project_or_product_uid, route_uid, page_size=page_size, page_num=page_num, cursor=cursor, device_uid=device_uid, sort_by=sort_by, sort_order=sort_order, start_date=start_date, end_date=end_date, system_files_only=system_files_only, most_recent_only=most_recent_only, files=files, routing_status=routing_status, response_status=response_status)
List a route's logs
List a route's attempts to send events, newest first, with each one's event, response status, body and duration. Filter by device, notefile, date, success or HTTP status. For one event, use GetRouteLogsByEvent. Paginated. Returns 404 if the route doesn't exist.
Example
import notehub_py
from notehub_py.models.route_log import RouteLog
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "PERSONAL_ACCESS_TOKEN"
)
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.RouteApi(api_client)
project_or_product_uid = 'app:2606f411-dea6-44a0-9743-1130f57d77d8' # str |
route_uid = 'route:cbd20093cba58392c9f9bbdd0cdeb1a0' # str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
page_size = 1000 # int | (optional) (default to 1000)
page_num = 1 # int | (optional) (default to 1)
cursor = 'cursor_example' # str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. (optional)
device_uid = ['device_uid_example'] # List[str] | A DeviceUID. (optional)
sort_by = 'date' # str | Field to sort by. - `date`: when the attempt was made - `event`: the order the events arrived in, then the attempt time (optional) (default to 'date')
sort_order = 'desc' # str | Sort direction. - `asc`: oldest first - `desc`: newest first (optional) (default to 'desc')
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
system_files_only = True # bool | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. (optional)
most_recent_only = True # bool | If true, return only the latest attempt for each event. (optional)
files = '_health.qo, data.qo' # str | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. (optional)
routing_status = ['failure'] # List[str] | Return only attempts with this outcome. - `success`: the destination accepted the event - `failure`: the attempt failed (optional)
response_status = ['500'] # List[str] | Response status codes to include, e.g. `500`. (optional)
try:
# List a route's logs
api_response = api_instance.get_route_logs_by_route(project_or_product_uid, route_uid, page_size=page_size, page_num=page_num, cursor=cursor, device_uid=device_uid, sort_by=sort_by, sort_order=sort_order, start_date=start_date, end_date=end_date, system_files_only=system_files_only, most_recent_only=most_recent_only, files=files, routing_status=routing_status, response_status=response_status)
print("The response of RouteApi->get_route_logs_by_route:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RouteApi->get_route_logs_by_route: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| route_uid | str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. | |
| page_size | int | [optional] [default to 1000] | |
| page_num | int | [optional] [default to 1] | |
| cursor | str | If supplied, results are returned in ascending order of modification time. A cursor is a timestamp: Unix epoch microseconds (UTC), optionally followed by `.N`. To start at a time, pass the bare microsecond value (inclusive; e.g. now minus 30 days); 0 starts from the beginning. To resume, pass next_cursor (or X-Next-Cursor) back unchanged; `.N` is the serial of the last row read at that microsecond, so nothing repeats or is skipped. | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| sort_by | str | Field to sort by. - `date`: when the attempt was made - `event`: the order the events arrived in, then the attempt time | [optional] [default to 'date'] |
| sort_order | str | Sort direction. - `asc`: oldest first - `desc`: newest first | [optional] [default to 'desc'] |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| system_files_only | bool | If true, return only events from system notefiles, such as `_session.qo` and `_health.qo`. | [optional] |
| most_recent_only | bool | If true, return only the latest attempt for each event. | [optional] |
| files | str | Comma-separated notefiles, e.g. `data.qo,_health.qo`. Don't combine with `systemFilesOnly`. | [optional] |
| routing_status | List[str] | Return only attempts with this outcome. - `success`: the destination accepted the event - `failure`: the attempt failed | [optional] |
| response_status | List[str] | Response status codes to include, e.g. `500`. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_routes
List[NotehubRouteSummary] get_routes(project_or_product_uid)
List routes
List a project's routes with their type and label and whether they're disabled, without their settings. For a route's settings, use GetRoute.
Example
import notehub_py
from notehub_py.models.notehub_route_summary import NotehubRouteSummary
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "PERSONAL_ACCESS_TOKEN"
)
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.RouteApi(api_client)
project_or_product_uid = 'app:2606f411-dea6-44a0-9743-1130f57d77d8' # str |
try:
# List routes
api_response = api_instance.get_routes(project_or_product_uid)
print("The response of RouteApi->get_routes:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RouteApi->get_routes: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
update_route
NotehubRoute update_route(project_or_product_uid, route_uid, notehub_route)
Update a route
Change a route's settings. Fields you leave out keep their values, and a secret sent back as (omitted) is kept, but leaving out notes clears it. Requires the Owner or Developer role. Returns 404 if the route doesn't exist, and 400 for invalid settings.
Example
import notehub_py
from notehub_py.models.notehub_route import NotehubRoute
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(
access_token = "PERSONAL_ACCESS_TOKEN"
)
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.RouteApi(api_client)
project_or_product_uid = 'app:2606f411-dea6-44a0-9743-1130f57d77d8' # str |
route_uid = 'route:cbd20093cba58392c9f9bbdd0cdeb1a0' # str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`.
notehub_route = {
"http" {
"filter": {
"type": "include",
"system_notefiles": true,
"files": ["somefile.qo"],
},
"throttle_ms": 50,
"url": "http://new-route.url",
},
}
# NotehubRoute | Route settings to be updated
try:
# Update a route
api_response = api_instance.update_route(project_or_product_uid, route_uid, notehub_route)
print("The response of RouteApi->update_route:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RouteApi->update_route: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| route_uid | str | RouteUID, e.g. `route:cbd20093cba58392c9f9bbdd0cdeb1a0`. List with `GetRoutes`. | |
| notehub_route | NotehubRoute | Route settings to be updated |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
Usage API
All URIs are relative to https://api.notefile.net
| Method | HTTP request | Description |
|---|---|---|
| get_api_usage | GET /v1/projects/{projectOrProductUID}/usage/api | Get billable API usage |
| get_data_usage | GET /v1/projects/{projectOrProductUID}/usage/data | Get cellular and satellite data usage |
| get_events_usage | GET /v1/projects/{projectOrProductUID}/usage/events | Get event usage |
| get_route_logs_usage | GET /v1/projects/{projectOrProductUID}/usage/route-logs | Get route log usage |
| get_sessions_usage | GET /v1/projects/{projectOrProductUID}/usage/sessions | Get session usage |
get_api_usage
GetApiUsage200Response get_api_usage(project_or_product_uid, period, start_date=start_date, end_date=end_date, limit=limit)
Get billable API usage
Count a project's billable Notehub API requests per day, week or month, by endpoint. Only requests billed against the project's plan are counted. Returns 400 if startDate is after endDate.
Example
import notehub_py
from notehub_py.models.get_api_usage200_response import GetApiUsage200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.UsageApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
period = "period_example" # str | The length of time each data point covers.
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
limit = 200000 # int | The most data points to return. If there are more, `truncated` is true. (optional) (default to 200000)
try:
# Get billable API usage
api_response = api_instance.get_api_usage(
project_or_product_uid,
period,
start_date=start_date,
end_date=end_date,
limit=limit,
)
print("The response of UsageApi->get_api_usage:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling UsageApi->get_api_usage: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| period | str | The length of time each data point covers. | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| limit | int | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_data_usage
GetDataUsage200Response get_data_usage(project_or_product_uid, period, start_date=start_date, end_date=end_date, device_uid=device_uid, fleet_uid=fleet_uid, limit=limit, aggregate=aggregate)
Get cellular and satellite data usage
Get the cellular and satellite data a project's devices used, in bytes. It's counted per day, week or month, by device, fleet or the whole project. If there are more data points than limit, the rest are dropped and truncated is true. Returns 400 for an unknown device, or if endDate is before startDate.
Example
import notehub_py
from notehub_py.models.get_data_usage200_response import GetDataUsage200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.UsageApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
period = "period_example" # str | The length of time each data point covers.
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
fleet_uid = ["fleet_uid_example"] # List[str] | Filter by FleetUID (optional)
limit = 200000 # int | The most data points to return. If there are more, `truncated` is true. (optional) (default to 200000)
aggregate = "device" # str | How to group the counts, such as per device or one total for the project. (optional) (default to 'device')
try:
# Get cellular and satellite data usage
api_response = api_instance.get_data_usage(
project_or_product_uid,
period,
start_date=start_date,
end_date=end_date,
device_uid=device_uid,
fleet_uid=fleet_uid,
limit=limit,
aggregate=aggregate,
)
print("The response of UsageApi->get_data_usage:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling UsageApi->get_data_usage: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| period | str | The length of time each data point covers. | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| fleet_uid | List[str] | Filter by FleetUID | [optional] |
| limit | int | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | str | How to group the counts, such as per device or one total for the project. | [optional] [default to 'device'] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_events_usage
UsageEventsResponse get_events_usage(project_or_product_uid, period, start_date=start_date, end_date=end_date, device_uid=device_uid, fleet_uid=fleet_uid, limit=limit, aggregate=aggregate, notefile=notefile, skip_recent_data=skip_recent_data, include_notefiles=include_notefiles)
Get event usage
Count a project's events per day, week or month, by device, fleet or the whole project, optionally per notefile. Summaries lag; with period=day and no endDate, the latest day is filled in from recent events unless skipRecentData is true. Returns 400 if startDate is after endDate.
Example
import notehub_py
from notehub_py.models.usage_events_response import UsageEventsResponse
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.UsageApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
period = "period_example" # str | The length of time each data point covers.
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
fleet_uid = ["fleet_uid_example"] # List[str] | Filter by FleetUID (optional)
limit = 200000 # int | The most data points to return. If there are more, `truncated` is true. (optional) (default to 200000)
aggregate = "device" # str | How to group the counts, such as per device or one total for the project. (optional) (default to 'device')
notefile = [
"notefile_example"
] # List[str] | Count only events from these notefiles. (optional)
skip_recent_data = False # bool | If true, return only summarized data, without filling in the latest day. Faster for large projects. (optional) (default to False)
include_notefiles = False # bool | If true, include event counts for each notefile. (optional) (default to False)
try:
# Get event usage
api_response = api_instance.get_events_usage(
project_or_product_uid,
period,
start_date=start_date,
end_date=end_date,
device_uid=device_uid,
fleet_uid=fleet_uid,
limit=limit,
aggregate=aggregate,
notefile=notefile,
skip_recent_data=skip_recent_data,
include_notefiles=include_notefiles,
)
print("The response of UsageApi->get_events_usage:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling UsageApi->get_events_usage: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| period | str | The length of time each data point covers. | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| fleet_uid | List[str] | Filter by FleetUID | [optional] |
| limit | int | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | str | How to group the counts, such as per device or one total for the project. | [optional] [default to 'device'] |
| notefile | List[str] | Count only events from these notefiles. | [optional] |
| skip_recent_data | bool | If true, return only summarized data, without filling in the latest day. Faster for large projects. | [optional] [default to False] |
| include_notefiles | bool | If true, include event counts for each notefile. | [optional] [default to False] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_route_logs_usage
GetRouteLogsUsage200Response get_route_logs_usage(project_or_product_uid, period, start_date=start_date, end_date=end_date, route_uid=route_uid, limit=limit, aggregate=aggregate, skip_recent_data=skip_recent_data)
Get route log usage
Count a project's attempts to send events to routes per day, week or month, by route or for the whole project. If there are more data points than limit, the rest are dropped and truncated is true.
Example
import notehub_py
from notehub_py.models.get_route_logs_usage200_response import (
GetRouteLogsUsage200Response,
)
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.UsageApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
period = "period_example" # str | The length of time each data point covers.
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
route_uid = ["route_uid_example"] # List[str] | A RouteUID. (optional)
limit = 200000 # int | The most data points to return. If there are more, `truncated` is true. (optional) (default to 200000)
aggregate = "route" # str | How to group the counts, per route or one total for the project. (optional) (default to 'route')
skip_recent_data = False # bool | If true, return only summarized data, without filling in the latest day. Faster for large projects. (optional) (default to False)
try:
# Get route log usage
api_response = api_instance.get_route_logs_usage(
project_or_product_uid,
period,
start_date=start_date,
end_date=end_date,
route_uid=route_uid,
limit=limit,
aggregate=aggregate,
skip_recent_data=skip_recent_data,
)
print("The response of UsageApi->get_route_logs_usage:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling UsageApi->get_route_logs_usage: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| period | str | The length of time each data point covers. | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| route_uid | List[str] | A RouteUID. | [optional] |
| limit | int | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | str | How to group the counts, per route or one total for the project. | [optional] [default to 'route'] |
| skip_recent_data | bool | If true, return only summarized data, without filling in the latest day. Faster for large projects. | [optional] [default to False] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get_sessions_usage
GetSessionsUsage200Response get_sessions_usage(project_or_product_uid, period, start_date=start_date, end_date=end_date, device_uid=device_uid, fleet_uid=fleet_uid, limit=limit, aggregate=aggregate, skip_recent_data=skip_recent_data)
Get session usage
Count a project's device sessions per day, week or month, by device, fleet or the whole project. If there are more data points than limit, the rest are dropped and truncated is true. Returns 400 if startDate is after endDate.
Example
import notehub_py
from notehub_py.models.get_sessions_usage200_response import GetSessionsUsage200Response
from notehub_py.rest import ApiException
from pprint import pprint
configuration = notehub_py.Configuration(access_token="PERSONAL_ACCESS_TOKEN")
# Enter a context with an instance of the API client
with notehub_py.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = notehub_py.UsageApi(api_client)
project_or_product_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
period = "period_example" # str | The length of time each data point covers.
start_date = 1628631763 # int | Start date for filtering results, specified as a Unix timestamp (optional)
end_date = 1657894210 # int | End date for filtering results, specified as a Unix timestamp (optional)
device_uid = ["device_uid_example"] # List[str] | A DeviceUID. (optional)
fleet_uid = ["fleet_uid_example"] # List[str] | Filter by FleetUID (optional)
limit = 200000 # int | The most data points to return. If there are more, `truncated` is true. (optional) (default to 200000)
aggregate = "device" # str | How to group the counts, such as per device or one total for the project. (optional) (default to 'device')
skip_recent_data = False # bool | If true, return only summarized data, without filling in the latest day. Faster for large projects. (optional) (default to False)
try:
# Get session usage
api_response = api_instance.get_sessions_usage(
project_or_product_uid,
period,
start_date=start_date,
end_date=end_date,
device_uid=device_uid,
fleet_uid=fleet_uid,
limit=limit,
aggregate=aggregate,
skip_recent_data=skip_recent_data,
)
print("The response of UsageApi->get_sessions_usage:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling UsageApi->get_sessions_usage: %s\n" % e)Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| project_or_product_uid | str | ||
| period | str | The length of time each data point covers. | |
| start_date | int | Start date for filtering results, specified as a Unix timestamp | [optional] |
| end_date | int | End date for filtering results, specified as a Unix timestamp | [optional] |
| device_uid | List[str] | A DeviceUID. | [optional] |
| fleet_uid | List[str] | Filter by FleetUID | [optional] |
| limit | int | The most data points to return. If there are more, `truncated` is true. | [optional] [default to 200000] |
| aggregate | str | How to group the counts, such as per device or one total for the project. | [optional] [default to 'device'] |
| skip_recent_data | bool | If true, return only summarized data, without filling in the latest day. Faster for large projects. | [optional] [default to False] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json