teamviewer.com link icon
or
Ask The Community

TeamViewer is one of the winners of the European Customer Centricity Award 🥳


Please find more information here.

Token Issue Getting List of TV Devices

Hey all, I'm trying to use PowerShell to query my TV account to retrieve a list of all of our computers. I'm working on trying to use the last_seen return value as part of an internal cleanup project.

In reading through the API and using a few of the pre-existing scripts on the internet, but am receiving the following error when trying to pull GET against api/v1/devices. 

{"error":"invalid_token","error_description":"Access token is of wrong type. You need a UserToken to call this function.","error_code":2}

Example code:

$TeamViewer_APIKey = ''

$bearer = "Bearer",$TeamViewer_APIKey
$header = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$header.Add("authorization", $bearer)

$request = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/devices" -Method Get -Headers $header

 

Tagged:

Best Answer

Answers