file Requests
The file
set of requests enable developers to work with all types of
Notefiles.
file.changes This request is available on all versions of Notecard Cellular.CellThis request is available on Notecard Cell+WiFi.Cell+WiFiThis request is available on Notecard LoRa.LoRaThis request is available on all versions of Notecard WiFi.WiFiThis request can be performed using the Notehub API.Notehub
Used to perform queries on a single or multiple files to determine if
new Notes are available to read, or if there are unsynced Notes in
local Notefiles. Note: This request is a Notefile API request, only.
.qo
Notes in Notehub are automatically ingested and stored, or sent
to applicable Routes.
files
array of strings (optional)
One or more files to obtain change information from. Omit to return changes for all Notefiles.
tracker
string (optional)
ID of a change tracker to use to determine changes to Notefiles.
access_token
string (Notehub curl requests only)
A Notehub API bearer token.
projectUID
string (Notehub curl requests only)
The ProjectUID of a Notehub project.
deviceUID
string (Notehub curl requests only)
The globally-unique DeviceUID of a device that currently exists within the specified ProjectUID.
You may alternatively provide a device serial number by prefixing this argument
with sn:
, for example sn:my-device
.
{
"req": "file.changes",
"tracker": "multi-file-tracker",
"files": ["my-settings.db", "other-settings.db"]
}
J *req = NoteNewRequest("file.changes");
JAddStringToObject(req, "tracker", "multi-file-tracker");
J *files = JAddArrayToObject(req, "files");
JAddItemToArray(files, JCreateString("other-settings.db"));
JAddItemToArray(files, JCreateString("my-settings.db"));
NoteRequest(req);
req = {"req": "file.changes"}
req["tracker"] = "multi-file-tracker"
req["files"] = ["my-settings.db", "other-settings.db"]
rsp = card.Transaction(req)
curl -X GET
-L 'https://api.notefile.net/v1/projects/<projectUID>/devices/<deviceUID>/files/changes?tracker=<tracker>&files=[<files>]'
-H 'Authorization: Bearer <access_token>'
Response Members
total
integer
The total of local Notes across all Notefiles. This includes Inbound Notes that have not been deleted, as well as outbound Notes that have yet to sync.
changes
integer
If a change tracker is used, the number of changes across all files.
info
JSON object
An object with a key for each Notefile that matched the request parameters,
and value object with the changes
and total
for each file.
{
"changes": 5,
"total": 5,
"info": {
"my-settings.db": { "changes": 3, "total": 3 },
"other-settings.db": { "changes": 2, "total": 2 }
}
}
file.changes.pending This request is available on all versions of Notecard Cellular.CellThis request is available on Notecard Cell+WiFi.Cell+WiFiThis request is available on Notecard LoRa.LoRaThis request is available on all versions of Notecard WiFi.WiFiThis request can be performed using the Notehub API.Notehub
Returns info about file changes that are pending upload to Notehub or download to the Notecard.
access_token
string (Notehub curl requests only)
A Notehub API bearer token.
projectUID
string (Notehub curl requests only)
The ProjectUID of a Notehub project.
deviceUID
string (Notehub curl requests only)
The globally-unique DeviceUID of a device that currently exists within the specified ProjectUID.
You may alternatively provide a device serial number by prefixing this argument
with sn:
, for example sn:my-device
.
{
"req": "file.changes.pending"
}
J *req = NoteNewRequest("file.changes.pending");
NoteRequest(req);
req = {"req": "file.changes.pending"}
rsp = card.Transaction(req)
curl -X GET
-L 'https://api.notefile.net/v1/projects/<projectUID>/devices/<deviceUID>/files/changes/pending'
-H 'Authorization: Bearer <access_token>'
Response Members
total
integer
The total of unsynched notes across all Notefiles.
changes
integer
The number of changes across all files.
pending
boolean
true
if there are pending changes.
info
JSON object
An object with a key for each Notefile
and value object with the changes
and total
for each file.
{
"total": 3,
"changes": 3,
"pending": true,
"info": {
"sensors.qo": { "changes": 3, "total": 3 }
}
}
file.delete This request is available on all versions of Notecard Cellular.CellThis request is available on Notecard Cell+WiFi.Cell+WiFiThis request is available on Notecard LoRa.LoRaThis request is available on all versions of Notecard WiFi.WiFiThis request can be performed using the Notehub API.Notehub
Deletes Notefiles and the Notes they contain.
files
array of strings
One or more files to delete.
access_token
string (Notehub curl requests only)
A Notehub API bearer token.
projectUID
string (Notehub curl requests only)
The ProjectUID of a Notehub project.
deviceUID
string (Notehub curl requests only)
The globally-unique DeviceUID of a device that currently exists within the specified ProjectUID.
You may alternatively provide a device serial number by prefixing this argument
with sn:
, for example sn:my-device
.
{
"req": "file.delete",
"files": ["my-settings.db", "other-settings.db"]
}
J *req = NoteNewRequest("file.delete");
J *files = JAddArrayToObject(req, "files");
JAddItemToArray(files, JCreateString("other-settings.db"));
JAddItemToArray(files, JCreateString("my-settings.db"));
NoteRequest(req);
req = {"req": "file.delete"}
req["files"] = ["my-settings.db", "other-settings.db"]
card.Transaction(req)
curl -X DELETE
-L 'https://api.notefile.net/v1/projects/<projectUID>/devices/<deviceUID>/files'
-H 'Authorization: Bearer <access_token>'
-d '{"files": [<files>]}'
Response Members
{}
means success.file.stats This request is available on all versions of Notecard Cellular.CellThis request is available on Notecard Cell+WiFi.Cell+WiFiThis request is available on Notecard LoRa.LoRaThis request is available on all versions of Notecard WiFi.WiFiThis request can be performed using the Notehub API.Notehub
Gets resource statistics about local Notefiles.
file
(Added in v1.5.6)
string (optional)
Returns the stats for the specified Notefile only.
{
"req": "file.stats"
}
J *req = NoteNewRequest("file.stats");
NoteRequest(req);
req = {"req": "file.stats"}
rsp = card.Transaction(req)
Response Members
total
integer
The total number of Notes across all Notefiles.
changes
integer
The number of Notes across all Notefiles pending sync.
sync
boolean
true
if a sync is recommended based on the number of pending notes.
{
"total": 83,
"changes": 78,
"sync": true
}