teamviewer.com link icon
or
Ask The Community

Unable to move group using API PUT call in powershell

Hi guys,

I can use the put method to make changes to a device from it's password to alias but whenever i include the group id of a group i am trying to move it to it fails. Below is an example of my code.


$Jsonbody= @{

   'groupId' = "g123456"

} | ConvertTo-Json


$URL = "Https://webapi.teamviewer.com/api/v1/devices/d123456"

$Response = Invoke-RestMethod -Header $header -Method PUT -ContentType "application/json" -Uri $URL -Body $Jsonbody -Verbose


The error I recieve.


Invoke-RestMethod : {"error":"internal_error","error_description":"Moving buddy failed.","error_code":3}

At line:1 char:13

+ $Response = Invoke-RestMethod -Header $header -Method PUT -ContentTyp ...

+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   + CategoryInfo         : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc

  eption

   + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand



If i include, for example an alias change in the json it will change that but still have this error and obviously not move the group. what am i doing wrong here?

Sign In or Register to comment.