If you just want to retrieve data on a device, I think you can apply this tutorial
There is a way to access device’s resources by a link, and it responds by a json array, and with that tutorial you can get data of devices without programming all of them, just programming the one that needs to get the data.