Description
Using PowerShell, the following JSON formatting works for a create user ;
$CreateZoomUserJSON = "
{
'action': 'ssoCreate',
'user_info':
{
'email':'user@domain.com',
'type':'2',
'first_name':'Simple',
'last_name':'Test'
}
}
"
$Body = $CreateZoomUserJSON -replace '''','"'
Invoke-RestMethod "https://api.zoom.us/v2/users" -Headers @{ Authorization = "Bearer $Accesstoken" } -Body ($Body) -Method Post -ContentType 'application/json'
However, when attempting the same formatting to provision a phone user, I get the error mentioned in the title;
$SetPlan = "
{
'calling_plans':{
'type':'200'
}
}
"
$Body = $SetPlan -replace '''','"'
Invoke-RestMethod "https://api.zoom.us/v2/phone/users/user@domain.com/calling_plans" -Headers @{ Authorization = "Bearer $Accesstoken" } -Body ($Body) -Method Post -ContentType 'application/json'
With the error shown below
Error
Invoke-RestMethod : {“code”:300,“message”:“Request Body should be a valid JSON object.”}
At line:79 char:3
+ Invoke-RestMethod "https://api.zoom.us/v2/phone/users/SimpleTest@ea …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Which Endpoint/s?
Shown above in description
How To Reproduce (If applicable)
Steps to reproduce the behavior:
Attempt the same formatting on Powershell when attempting to assign a calling plan/number/ext.