If desired a domain (we will refer it as "main sensor") can be completely overriden with the content given on the request payload. The request payload should be in JSON format. Said JSON must have a single "sensor" root tag describing the content of the "main sensor" to override with. To prevent errors, we can't change the value of UUID for "main sensor". Child domains can be set using the "children" value where inheritance applies. Multiple inheritance levels are allowed.
We need to take into account some points:
If the sensor_uuid is not present at the URL, the sensor will be override is the Top domain of the user.
If a child of main sensor hasn't define UUID, API tries to find a child that coincide on name, domain_type and type params. If API finds a child, it will be updated, else API will create a new sensor.
Access Points ignore sensor_name and sensor_uuid params. All APS of a sensor will be added to it.
If we need to create a sensor and type or domain_type are not present in JSON, default values are DOMAIN and GENERIC respectively.
If there are an error creating/updating sensors, the app rollback all changes.
If "main sensor" or a child it's a domain or a sensor flow it can contain a list of associated access points. To describe these access points you may use the "access_points" value. If this value is found in an element that it is not a flow nor a domain it will be ignored. Regular rules apply to access points and domain creation with the exception of parent IDs (sensor_id and switch_id for the access points; parent_id for domains) which are not allowed as inheritance is described by JSON nesting. This request can be executed by issuing a POST request to the following URI:
https://hostname/api/v1/sensors/:sensor_uuid/override_all?auth_token=xxxxxx
Where :sensor_uuid should be replaced for the domain UUID to override.
Another option is not define sensor_uuid. In this case, domain will be override is the top domain of the user with auth_toke equals to xxxxxx.
https://hostname/api/v1/sensors/override_all?auth_token=xxxxxx
To override a domain the requesting user must have management permissions on the requested domain. If that is not the case HTTP 401 Unauthorized status code will be returned. If the requested domain does not exists HTTP 404 Not Found status code will be returned. If request is successful HTTP 200 OK status code will be returned with "query" set to true. On the following lines you may find an exeution example:
Request:
HTTP Verb: POST
URI: https://hostname/api/v1/sensors/697893457705749905/override_all?auth_token=xxxxxx
Payload: {
"sensor": {
"name": "Override_parent",
"domain_type": "1",
"children": [
{
"name": "Override_child",
"domain_type": "1"
},
{
"name": "Override_child_2",
"domain_type": "1",
"children": [
{
"name": "Override_grandson_1",
"domain_type": "5",
"access_points": [
{
"mac_address": "22:ca:cc:dd:ff:11",
"name": "Demo AP_Flow1"
},
{
"mac_address": "11:22:cc:ab:ff:ea",
"name": "Demo AP_Flow2"
}
]
},
{
"name": "Override_grandson_2",
"domain_type": "101",
"access_points": [
{
"mac_address": "bb:ca:cc:bd:af:22",
"name": "Demo AP1"
},
{
"mac_address": "11:22:ac:dd:ff:44",
"name": "Demo AP2"
}
]
}
]
}
]
}
}
Response:
Status Code: 200 OK
Body: {
"query": "true"
}