-
Notifications
You must be signed in to change notification settings - Fork 1
Meta Requests
Syncmesh stores metadata in the MongoDB instance, most importantly available external nodes and data regarding the own node. This data can be used to query nodes without specifying external IPs (use_meta
parameter in the default request), and aggregation/collection with radius geofencing is possible.
A meta request has the following parameters:
-
"meta_type"
: specifies the meta request type. Can be either "get", "update" or "delete" -
"id"
: specifies the relevant Node ID. Optional, only relevant for "update" or "delete" -
"node"
: the node json object to modify/create. Optional, only relevant for "update"
If you do not specify the ID or MongoDB can't find it, a new node will be created:
{
"meta_type": "update",
"node": {
"address": "http://some.ip.here",
"lat": 43,
"lon": 43,
"subscribed": true,
"own_node": true
}
}
If you want to update instead of creating, specify the relevant parameters and the ID:
{
"meta_type": "update",
"id": "614f2c3cd9b5863f8ec035b1",
"node": {
"address": "http://some.ip.here/",
"lon": 41,
"subscribed": true,
"lat": 42,
"own_node": false
}
}
It is important you pass all parameters when updating the node, otherwise, those not mentioned get set to 0/false/"". The id in the example above is just an example hex value.
Deleting works by just specifying the ID:
{
"meta_type": "delete",
"id": "document_id_here"
}
You can also fetch the array of all saved nodes with a simple:
{"meta_type": "get"}