I have to add another note on your second question:
If you don't remove device_name from the dict if it's empty, apache will report an error like this:
"Invalid input for field/attribute device_name. Value: None. None is not of type 'string'"
That's why I removed it.
I have to add another note on your second question:
If you don't remove device_name from the dict if it's empty, apache will report an error like this:
"Invalid input for field/attribute device_name. Value: None. None is not of type 'string'"
That's why I removed it.