add restriction to device deletion in REST API
Merge branch 'missing-restapi-tests'