Comments (5)
This issue is also reproduced in my language, Japanese. (I hadn't noticed this bug until now.)
The is caused by not specifying a charset in the ContentType parameter of the Invoke-RestMethod. if it does not specify, PowerShell seems to implicitly use ISO-8859-1 encoding, which does not support non-Latin characters are not supported.
Try this code. This worked for my environment.
$Token = New-ZoomApiToken -ApiKey $Global:ZoomApiKey -ApiSecret $Global:ZoomApiSecret
$FirstName = 'Vlad'
$LastName = 'Путин'
$Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user"
$RequestBody = @{
'first_name' = $FirstName
'last_name' = $LastName
}
$RequestBody = $RequestBody | ConvertTo-Json
Invoke-RestMethod -Uri $request.Uri -Headers @{'authorization' = ('bearer ' + $Token)} -Body $requestBody -Method PATCH -ContentType 'application/json; charset=utf-8'
Setting the default value of the ContentType parameter in Invoke-ZoomRestMethod to 'application/json; charset=utf-8'
may be a solution, but we need to check for any bad side effects.
If you give me a few days, I can provide a pull request, what do you think, @JosephMcEvoy
from pszoom.
Заранее благодарю :) (Привет из России)
from pszoom.
I am not sure what is wrong. It could have to do with the content-type, which is set in New-ZoomHeaders then passed to Invoke-ZoomRestMethod, which calls Invoke-RestMethod. It could also have to do with how PowerShell and Zoom interpret the characters. Possibly a combination of the two.
@mkht may have some experience with this as he may be using non-Latin characters.
Here is the simplified relevant bits of a code to help you in seeking help outside of Github:
$Token = New-Jwt -Algorithm 'HS256' -type 'JWT' -Issuer $Credentials.ApiKey -SecretKey $Credentials.ApiSecret -ValidforSeconds $ValidforSeconds
$FirstName = 'Vlad'
$LastName = 'Путин'
$Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$Headers.Add('content-type' , 'application/json')
$Headers.Add('authorization', 'bearer ' + $Token)
$Request = [System.UriBuilder]"https://api.zoom.us/v2/users/$user"
$RequestBody = @{
'first_name' = $FirstName
'last_name' = $LastName
}
$RequestBody = $RequestBody | ConvertTo-Json
Invoke-RestMethod -Uri $request.Uri -Headers ([ref]$Headers) -Body $requestBody -Method PATCH
from pszoom.
Good analysis and summary. If you have the bandwidth, proceed. Depending on testing, I/we may have to consider adding -ContentType as another parameter for all cmdlets. Thank you for your help, as always.
from pszoom.
@mkht , @JosephMcEvoy Thank you very much! Спасибо!))
I can continue to work with my project !!!
For me -ContentType 'application / json; charset = utf-8 '
works too))
from pszoom.
Related Issues (20)
- Is there a way to add a manager to a zoom user?
- Error when creating new users: "Invalid URI: The hostname could not be parsed." HOT 3
- Get-ZoomMeetings Error 400 Bad Request HOT 1
- Whatif doesn't prevent action
- 404 Error Removing Users HOT 9
- Get-ZoomUsers -Status All HOT 1
- Get-ZoomUsers HOT 1
- Cannot bind argument to parameter 'InputObject' because it is null HOT 1
- new-zoomUser Error 400 bad request HOT 9
- Unable to connect with new PSZoom version HOT 9
- Get Sub Account Users HOT 5
- Restart-ZoomRoom 401 error HOT 2
- change the "user type" HOT 1
- Getting Unauthorized error when using Get-ZoomAccountRecordings HOT 1
- zoom call queues HOT 1
- Powershell Gallery is missing new Zoom Phone Functions
- ParticipantVideo parameter not supported by NewMeeting or UpdateMeeting HOT 1
- User accounts not getting created HOT 1
- "Cannot process argument transformation on parameter 'Token'" after updating to 2.0.4.0 HOT 3
- [Query] billing api. Is it possible to query licenses? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pszoom.