Deleting device from Teamviewer using alias in API

Hi, 

I'm trying to create a script that will allow us to automate the deletion of devices using the API for a disposal process.

I can return a device based on the remotecontrol_id parameter but I can only get this value by finding the machine in the TV management console which defeats the point of automating the process. 

Is it possible to pull out a device_id value using the devices alias? Our aliases are mapped to the machines hostname which is the information we have when disposing of a machine. 

Thank you

Andrew

Comments

  • DomLan
    DomLan Posts: 490 ⭐Star⭐

    Hi @Andytaylor93,

    you can use the GET method to recover all the devices of a specific group or all those associated to the user with which you have authenticated and read. The level of access is therefore that of the user and not for the company. Translated, this means that you can create some code that, after asking the operator to log in via OAuth on TeamViewer, read his contact list and execute the cancellation according to your rules.

    One of the least-minded sections of the TeamViewer API manual is the one dedicated to the permissions required to run each REST command. When you encounter the User permission level, it is implied that the operation can be performed only by the user (with script token or app token), and is substantially limited to its scope of validity (the groups to which it has access and all that is connected to the its single authentication).

    It is not an operation that the company administrator can perform via API for all accounts. Keep in mind that a single device may be present in the contact list of your company's users with different aliases.

    Hope this help.

    Regards.

     

    Domenico Langone

    MCSD: App Builder

  • christian-j
    christian-j Posts: 54 Staff member 🤠

    Hello,

    maybe you could use and extend the following example script:
    https://github.com/teamviewer/api-example-scripts/tree/master/Remove-TeamViewerOutdatedDevice

     

    Team Lead Product Development (Enterprise)

    Did my reply answer your question? To help others, please accept it as solution. Thanks!