How to change "Country" on Phone System Management" via API

Description
I want to know what API URL I can use to change the Country/Region of a user at the “Phone System Management”

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

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

  1. Open Portal
  2. Go to Phone Management System -
  3. Select a User, and change their country/region

Hi @diego.marins ,

Happy to help. You can use this endpoint to update the country:

Is this what you’re looking for?

Thanks,
Gianni

Hi!!

Unfortunately, I tried that one but it did not change the Country on the User Phone page :frowning:

Thanks for the quick response

Ahh I see @diego.marins – what endpoint are you using to retrieve the details please? This can help me determine the right PATCH request :slight_smile:

Here is my code :slight_smile:

# URL Builder
$url_base = "https://api.zoom.us/v2"
$api = "/users/$($EmailAddress)?login_type=101"
$uri = "$($url_base)$($api)"

# Header
$header_block = @{ 
        "User-Agent" = "Zoom-Jwt-Request"
        "content-type" = "application/json"
        "authorization" = "Bearer $($token)"
}  

# Body Request
$request_body = @{ 
        "phone_number" = "+1XXXxxxx"
        "phone_country" = "ca"
}

$request_json = $request_body | ConvertTo-Json

$InvokeList = Invoke-RestMethod -Method Patch -ContentType "application/json" -Uri $uri -Headers $header_block -Body $request_json

Hello,
I don’t think you can use that endpoint with JWT, you should switch to an oauth2 application.

Bye,
Claudio

Hi @claudiog64 !

It’s possible use JWT, I ran it using different parameters like “company” and “job_title” and reflected on my account :slight_smile:

All my other codes files uses JWT and works normally :slight_smile:

Oh I see … I confused the API.

When updating the user phone info, you have to provide both the country (ISO uppercase two letter code) AND the phone number toghether but omitting the international prefix code.
Otherwise it will not update it.

Please prefer to write code to the new phone_numbers object instead of the old fileds.

Ciao,
Claudio

Unfortunately, I’m getting a 400 code when I execute it with the parameters that you said. Here is my code:

Body Request

$request_body = @{
“phone_numbers” = @{
“country” = “CA”
“number” = “YYYxxxXXXX”
}
$request_json = $request_body | ConvertTo-Json -Depth 3

ErrorMessage

Response status code does not indicate success: 400 ().

Hi @diego.marins
unfortunately the resulting JSON is malformed, the phone_numbers is an array.

It should look something like:

$request_json = @’
{
“phone_numbers”: [
{“country” : “IT”, “code”: “+39”, “number”: “0001111111”, “label”: “Mobile”},
{“country” : “IT”, “code”: “+39”, “number”: “223333333”, “label”: “Office”}
]
}
'@

Hope this helps.

Ciao,
Claudio

Hi Claudio!

I copy and paste your code and it’s still getting an error message.

$request_json = @’
{
“phone_numbers”: [
{“country” : “CA”, “code”: “+1”, “number”: “YYYZZZXXXX”, “label”: “Mobile”}
]
}
'@

ErrorMessage

Error: Response status code does not indicate success: 401 ().

I think this is not what I’m looking for… :slight_smile:
I need to change the Country/Region of the User but inside the “Phone Management System” not on “User Management”

Hey diego.marins,

My understanding is that the Phone Management System user is tied to a regular Zoom User. Updating the phone_numbers object in the Update User Settings API should be the way to go here.

Since you’re getting a 401 status in response it sounds like your authentication may be the issue. I would double-check your authentication method from there.

If that doesn’t help, please submit a ticket and include a link to this thread. In that ticket, please provide the full request that you’re making and I’ll work to reproduce the issue.

You can submit a ticket by navigating to our Developer Support Center.

Thanks,
Max