Route API
The Notehub route API provides RESTful methods that can be used to GET
, PUT
,
POST
, and DELETE
Notehub routes.
Name | HTTP Request |
---|---|
Get Routes | GET /v1/projects/{projectUID}/routes |
Get Route | GET /v1/projects/{projectUID}/routes/{routeUID} |
Get Route Logs | GET /v1/projects/{projectUID}/routes/{routeUID}/route-logs |
Create Route | POST /v1/projects/{projectUID}/routes |
Delete Route | DELETE /v1/projects/{projectUID}/routes/{routeUID} |
Update Route | PUT /v1/projects/{projectUID}/routes/{routeUID} |
Get Routes Notehub
Get an array of routes associated with a Notehub project.
HTTP Method: | GET |
URL: | https://api.notefile.net/v1/projects/{projectUID}/routes |
Path Parameters: |
|
Minimum Notehub project-level role: | viewer |
Required HTTP Headers: | Authorization: Bearer <access_token> , where the access token is a Notehub API bearer token. |
curl -X GET
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes'
-H 'Authorization: Bearer <access_token>'
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
apiInstance.getRoutes(projectUID).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
import notehub_py
from notehub_py.models.user_db_route import UserDbRoute
from notehub_py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
host = "https://api.notefile.net"
)
# Configure API key authorization: api_key
configuration.api_key["api_key"] = os.environ["API_KEY"]
# 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_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
try:
api_response = api_instance.get_routes(project_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)
Response Members
uid
string
The globally-unique identifier of the route.
label
string
The name of the route.
type
string
The service to which this route connects (see Create Route for a full list of route types).
modified
string
The date and time this route was last modified.
disabled
boolean
Whether or not this route is disabled.
[
{
"uid": "route:0ac565deb7b478a250bb82347b9cfdd2",
"label": "My HTTP Route",
"type": "http",
"modified": "2020-03-09T17:58:36Z",
"disabled": false
},
{
"uid": "route:fb1b9e0aba1bf030311ba2c3c1e7efd1",
"label": "My Proxy Route",
"type": "proxy",
"modified": "2020-03-09T17:58:35Z",
"disabled": false
}
]
Get Route Notehub
Get a single route by its RouteUID.
HTTP Method: | GET |
URL: | https://api.notefile.net/v1/projects/{projectUID}/routes/{routeUID} |
Path Parameters: |
|
Minimum Notehub project-level role: | viewer |
Required HTTP Headers: | Authorization: Bearer <access_token> , where the access token is a Notehub API bearer token. |
curl -X GET
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes/<routeUID>'
-H 'Authorization: Bearer <access_token>'
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
apiInstance.getRoute(projectUID, routeUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
import notehub_py
from notehub_py.models.notehub_route import NotehubRoute
from notehub_py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
host = "https://api.notefile.net"
)
# Configure API key authorization: api_key
configuration.api_key["api_key"] = os.environ["API_KEY"]
# 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_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
route_uid = "route:cbd20093cba58392c9f9bbdd0cdeb1a0" # str |
try:
api_response = api_instance.get_route(project_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)
Response Members
uid
string
The globally-unique identifier of the route.
label
string
The name of the route.
type
string
The service to which this route connects (see above for a full list of route types).
modified
string
The date and time this route was last modified.
disabled
boolean
Whether or not this route is disabled.
schema
object
Additional meta data specific to the type of route (see request members from Create Route for a complete list).
{
"uid": "route:0ac565deb7b478a250bb82347b9cfdd2",
"label": "My HTTP Route",
"type": "http",
"modified": "2020-03-09T17:58:36Z",
"disabled": false,
"http": {
"fleets": ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
"filter": {
"type": "",
"system_notefiles": false
},
"transform": {},
"throttle_ms": 100,
"url": "http://route.url",
"http_headers": null,
"disable_http_headers": false,
"timeout": 0
}
}
Get Route Logs Notehub
Get an array of route logs associated with a Notehub project.
HTTP Method: | GET |
URL: | https://api.notefile.net/v1/projects/<projectUID>/routes/<routeUID>/route-logs |
Path Parameters: |
|
Minimum Notehub project-level role: | viewer |
Required HTTP Headers: | Authorization: Bearer <access_token> , where the access token is a Notehub API bearer token. |
pageSize
integer (optional)
Specifies the number of events to be returned by a request (default 50).
pageNum
integer (optional)
Specifies the page number of the results returned (useful when the pageSize
is
less than the total number of sessions that could be returned).
deviceUID
string (optional)
The DeviceUID of a Notehub device.
You may alternatively provide a device serial number by prefixing this argument
with sn:
, for example sn:my-device
.
sortBy
string (optional)
Specifies a field in the result set to sort by, and must be one of the
following: best_id
, device_serial
, device_uid
, captured
,
modified
, device_location
, tower_location
,
triangulated_location
, best_location
.
sortOrder
string (optional)
Specifies the ascending (asc
) or descending (desc
) order of the result set
when paired with sortBy
. The default is asc
.
startDate
UNIX Epoch time (optional)
The start date/time stamp of the events to be returned.
endDate
UNIX Epoch time (optional)
The end date/time stamp of the events to be returned.
systemFilesOnly
boolean (optional)
If true
, will only return System Notefiles in
the response.
files
string (optional)
A comma-delimited list of Notefile(s) this request should return events from.
For example, setting this argument to track.qo,sensor.qo
would return events
only from the track.qo
and sensor.qo
Notefiles.
curl -X GET
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes/<routeUID>/route-logs'
-H 'Authorization: Bearer <access_token>'
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
let opts = {
pageSize: 50, // Number |
pageNum: 1, // Number |
deviceUID: ["null"], // [String] | A Device UID.
sortBy: "captured", // String |
sortOrder: "asc", // String |
startDate: 1628631763, // Number | Unix timestamp
endDate: 1657894210, // Number | Unix timestamp
systemFilesOnly: true, // Boolean |
files: "_health.qo, data.qo" // String |
};
apiInstance.getRouteLogsByRoute(projectUID, routeUID, opts).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
import notehub_py
from notehub_py.models.get_route_logs_by_route200_response_inner import GetRouteLogsByRoute200ResponseInner
from notehub_py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
host = "https://api.notefile.net"
)
# Configure API key authorization: api_key
configuration.api_key["api_key"] = os.environ["API_KEY"]
# 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_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
route_uid = "route:cbd20093cba58392c9f9bbdd0cdeb1a0" # str |
page_size = 50 # int | (optional) (default to 50)
page_num = 1 # int | (optional) (default to 1)
device_uid = ["device_uid_example"] # List[str] | A Device UID. (optional)
sort_by = "captured" # str | (optional) (default to "captured")
sort_order = "asc" # str | (optional) (default to "asc")
start_date = 1628631763 # int | Unix timestamp (optional)
end_date = 1657894210 # int | Unix timestamp (optional)
system_files_only = True # bool | (optional)
files = "_health.qo, data.qo" # str | (optional)
try:
api_response = api_instance.get_route_logs_by_route(project_uid, route_uid, page_size=page_size, page_num=page_num, 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, files=files)
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)
curl -X GET
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes/<routeUID>/route-logs?pageSize=<pageSize>&pageNum=<pageNum>&deviceUID=<deviceUID>&sortBy=<sortBy>&sortOrder=<sortOrder>&startDate=<startDate>&endDate=<endDate>&systemFilesOnly=<systemFilesOnly>&files=<files>'
-H 'Authorization: Bearer <access_token>'
Response Members
date
string
The date/time stamp of the log entry.
routeUID
string
The globally-unique identifier of the route.
eventUID
string
The globally-unique identifier of the event.
attn
boolean
Whether the event was routed in error.
status
string
The status of the event.
text
string
The response body of the route.
[
{
"date": "2023-05-06T05:40:51.80559Z",
"routeUID": "app:4be5d3ac-998a-44f0-8ecd-6bd716858b3d/route:d632e16fc956162ae3db4f20ddacc2b8",
"eventUID": "5ee2e385-e282-476e-afec-327498fe91a3",
"attn": false,
"status": "200",
"text": "thanks"
},
{
"date": "2023-05-06T05:40:51.318522Z",
"routeUID": "app:4be5d3ac-998a-44f0-8ecd-6bd716858b3d/route:d632e16fc956162ae3db4f20ddacc2b8",
"eventUID": "4fb2c905-080a-40c5-96f7-d8193fa18116",
"attn": false,
"status": "200",
"text": "thanks"
}
]
Create Route Notehub
Create a new route within a Notehub project.
HTTP Method: | POST |
URL: | https://api.notefile.net/v1/projects/{projectUID}/routes |
Path Parameters: |
|
Minimum Notehub project-level role: | developer |
Required HTTP Headers: | Authorization: Bearer <access_token> , where the access token is a Notehub API bearer token. |
label
string
The name of the route.
disabled
boolean
Whether or not this route is disabled.
type
string
The specific service to which this route connects.
Must be one of: "arduino", "aws-iot-analytics", "aws-lambda", "aws-lambda-with-access-key", "aws-sqs", "aws-sqs-fifo", "aws-sqs-fifo-with-access-key", "aws-sqs-with-access-key", "azure-function", "azure-function-with-key", "azure-service-bus-with-sas-token", "blynk", "datacake", "google-function", "http", "mqtt", "proxy", "radnote-radresp-fixed-survey", "radnote-radresp-mobile-survey", "slack-bearer", "slack-webhook", "snowflake", "thingworx", "twilio".
schema
string
Name of the high-level route schema, used to supply settings specific to the
chosen type
above. This will be an object that includes route-specific
configuration. For example, to specify the URL of an HTTPS route you would
provide {"http":{"url":"https://my-site.com"}}
.
Must be one of: "arduino"
, "aws"
, "azure"
, "blynk"
, "datacake"
,
"google"
, "http"
, "mqtt"
, "proxy"
, "radresponder"
, "slack"
,
"snowflake"
, "thingworx"
, "twilio"
.
<schema>.fleets
string
An array of fleetUIDs to which to apply the route. If empty, applies to all fleets.
<schema>.filter
object
Route filtering settings; see below:
<schema>.filter.type
string
Which Notefiles this route applies to. Must be one of: "all"
, "include"
,
"exclude"
.
<schema>.filter
.system
_notefiles
boolean
Whether or not system Notefiles should be routed.
<schema>.filter.files
string
An array of Notefile names to include in the filter. For example, if include
is the type
, these are the only Notefiles that will be included.
<schema>.transform
object
Data transformation settings; see below:
<schema>.transform
.format
string
The data transformation to apply.
Must be one of: "bridge"
(Azure only), "jsonata"
, "flatten"
, "simple"
,
"body"
, "payload"
.
<schema>.transform
.jsonata
string
If jsonata
format, the JSONata expression to be used.
<schema>.throttle_ms
integer
Minimum time between requests, in milliseconds.
<schema>.url
string
The external service endpoint URL.
<schema>.http_headers
object
Key:value pairs of HTTP headers. Both the key and value are strings.
<schema>.disable
_http
_headers
boolean
Whether or not the HTTP header values should be disabled.
<schema>.timeout
integer
Timeout in seconds for each request.
curl -X POST
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes'
-H 'Authorization: Bearer <access_token>'
-d '{
"label":"<label>",
"type":"<type>",
"<schema>":{
"url":"<url>",
"fleets": ["<fleetUID>"],
"filter": {
"type": "all",
"system_notefiles": false
}
}
}'
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let notehubRoute = {
label: "Route Label",
type: "http",
http: {
fleets: ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
throttle_ms: 100,
url: "http://route.url",
},
}; // NotehubRoute | Route to be Created
apiInstance.createRoute(projectUID, notehubRoute).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
import notehub_py
from notehub_py.models.notehub_route import NotehubRoute
from notehub_py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
host = "https://api.notefile.net"
)
# Configure API key authorization: api_key
configuration.api_key["api_key"] = os.environ["API_KEY"]
# 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_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
notehub_route = {
"label": "Route Label",
"type":"http",
"http": {
"fleets": ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
"throttle_ms": 100,
"url": "http://route.url"
}
}
# NotehubRoute | Route to be Created
try:
api_response = api_instance.create_route(project_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)
Response Members
uid
string
The globally-unique identifier of the route.
label
string
The name of the route.
type
string
The service to which this route connects (see above for a full list of route types).
modified
string
The date and time this route was last modified.
disabled
boolean
Whether or not this route is disabled.
schema
object
Additional meta data specific to the type of route (see available arguments above for a complete list).
{
"uid": "route:0ac565deb7b478a250bb82347b9cfdd2",
"label": "My HTTP Route",
"type": "http",
"modified": "2020-03-09T17:58:36Z",
"disabled": false,
"http": {
"fleets": ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
"filter": {
"type": "",
"system_notefiles": false
},
"transform": {},
"throttle_ms": 100,
"url": "http://route.url",
"http_headers": null,
"disable_http_headers": false,
"timeout": 0
}
}
Delete Route Notehub
Delete a single route by its RouteUID.
HTTP Method: | DELETE |
URL: | https://api.notefile.net/v1/projects/{projectUID}/routes/{routeUID} |
Path Parameters: |
|
Minimum Notehub project-level role: | developer |
Required HTTP Headers: | Authorization: Bearer <access_token> , where the access token is a Notehub API bearer token. |
access_token
curl -X DELETE
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes/<routeUID>'
-H 'Authorization: Bearer <access_token>'
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
apiInstance.deleteRoute(projectUID, routeUID).then((data) => {
console.log("API called successfully. Returned data: " + JSON.stringify(data));
}, (error) => {
console.error(error);
});
import notehub_py
from notehub_py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
host = "https://api.notefile.net"
)
# Configure API key authorization: api_key
configuration.api_key["api_key"] = os.environ["API_KEY"]
# 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_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
route_uid = "route:cbd20093cba58392c9f9bbdd0cdeb1a0" # str |
try:
api_response = api_instance.delete_route(project_uid, route_uid)
print("The response of RouteApi->delete_route:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RouteApi->delete_route: %s\n" % e)
Update Route Notehub
Update a route by its RouteUID.
HTTP Method: | PUT |
URL: | https://api.notefile.net/v1/projects/{projectUID}/routes/{routeUID} |
Path Parameters: |
|
Minimum Notehub project-level role: | developer |
Required HTTP Headers: | Authorization: Bearer <access_token> , where the access token is a Notehub API bearer token. |
object
object
Additional meta data specific to the type of route.
Look up the specific argument list for your specified route in the Create Route documentation.
curl -X PUT
-L 'https://api.notefile.net/v1/projects/<projectUID>/routes/<routeUID>'
-H 'Authorization: Bearer <access_token>'
-d '{
"label":"<label>",
"type":"<type>",
"<schema>":{
"url":"<url>"
}
}'
import * as NotehubJs from "@blues-inc/notehub-js";
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications["api_key"];
api_key.apiKey = "YOUR API KEY";
let apiInstance = new NotehubJs.RouteApi();
let projectUID = "app:2606f411-dea6-44a0-9743-1130f57d77d8"; // String |
let routeUID = "route:cbd20093cba58392c9f9bbdd0cdeb1a0"; // String |
let notehubRoute = {
http: {
filter: {
type: "include",
system_notefiles: true,
files: ["somefile.qo"]
},
throttle_ms: 50,
url: "http://new-route.url",
},
}; // NotehubRoute | Route settings to be updated
apiInstance.updateRoute(projectUID, routeUID, notehubRoute).then(
(data) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
},
(error) => {
console.error(error);
}
);
import notehub_py
from notehub_py.models.notehub_route import NotehubRoute
from notehub_py.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.notefile.net
configuration = notehub_py.Configuration(
host = "https://api.notefile.net"
)
# Configure API key authorization: api_key
configuration.api_key["api_key"] = os.environ["API_KEY"]
# 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_uid = "app:2606f411-dea6-44a0-9743-1130f57d77d8" # str |
route_uid = "route:cbd20093cba58392c9f9bbdd0cdeb1a0" # str |
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:
api_response = api_instance.update_route(project_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)
Response Members
uid
string
The globally-unique identifier of the route.
label
string
The name of the route.
type
string
The service to which this route connects (see above for a full list of route types).
modified
string
The date and time this route was last modified.
disabled
boolean
Whether or not this route is disabled.
schema
object
Additional meta data specific to the type of route (see request members from Create Route for a complete list).
{
"uid": "route:0ac565deb7b478a250bb82347b9cfdd2",
"label": "My HTTP Route",
"type": "http",
"modified": "2020-03-09T17:58:36Z",
"disabled": false,
"http": {
"fleets": ["fleet:1042ddc5-3b2c-4cec-b1fb-d3040538094d"],
"filter": {
"type": "",
"system_notefiles": false
},
"transform": {},
"throttle_ms": 100,
"url": "http://route.url",
"http_headers": null,
"disable_http_headers": false,
"timeout": 0
}
}