Rename a device from API

Hello there,

I have trouble renaming the devices, I am able to receive the correct name from the API whenever i change it in the database. How do I change the device name in the code? I am able to log the name received from the API to the console.

Probably using updateDevice.