API Call POST Method with powershell seems not be working

Invoke-RestMethod: “POST” end in unclear error message

I am executing the following commands:

$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(‘Content-Type’ , $contentType)
$headers.Add(‘Authorization’,'Bearer ’ + $token)
$base_uri = “https://api.zoom.us/v2
$body = @{
“description” = “Testtemplate for phone users”
“name” = “Phone User Template”
“site_id” = $phoneID
“type” = “user”
} | ConvertTo-Json

Invoke-RestMethod -uri $base_uri+"/phone/setting_templates" -Method POST -Body $body -Headers $headers -ContentType “application/json”

As a result I am receiving the following (not real) Error / Information message
window.zmGlobalMrktId = “5fda3c08cc144b719072d9**********” || null;
window.zmGlobalMrktKey = “” || null;
Page Not Found - Zoom
var resourceAccountIdRoutingURl = “”;
resourceAccountIdRoutingURl = resourceAccountIdRoutingURl==""?undefined:resourceAccountIdRoutingURl;
var _market_OneTrust_CookieArray = ;
_market_OneTrust_CookieArray.push({name: “_zm_tracking_guid”, value: “a644c1cce40a4445a5f8668b6bbe0c4e”});
var _zm_cookie_domain = “.zoom.us”;
body div.combobox div.dropdownlist{
width: calc(100% + 2px) !important;

And the output in general is much longer than i have space here, but these are the first and seems to be the most important ones.

Which App Type (OAuth / Chatbot / JWT / Webhook)?

Which Endpoint/s?

How To Reproduce (If applicable)
Steps to reproduce the behavior:

  1. Invoke-RestMethod -uri $base_uri+"/phone/setting_templates" -Method POST -Body $body -Headers $headers -ContentType “application/json”
  2. window.zmGlobalMrktKey = “” || null;

Additional context
$token, $phone_site_detail.id and the access via JWT in general is working, because I am getting all expected information with the RestAPI GET Method.

Does anyone has some ideas, what i am doing wrong here?

Hi @dennis.raulien

Hope you are doing great and welcome to our community!
Allow me some time to try and replicate this error on my end and I will come back to you shortly!

1 Like

Hey there!

Thanks for your patience. I have not been able to replicate this error on my end.
Could you please make sure that you are passing application/json as the contentType?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.