Jericho / ZoomNet

.NET client library for the Zoom.us REST API v2
MIT License
68 stars 48 forks source link

Exception when calling Users.UpdateAsync and specifying a user type #260

Closed Sanx78 closed 1 year ago

Sanx78 commented 1 year ago

(Excuse the code in VB...)

Trying to set a user's license status (user type) via UpdateAsync, or setting any property and including a user type, ends up generating the ZoomException: Request Body should be a valid JSON object.

The snippet below fails, and also fails changing the user type to UserType.Licensed:

Dim ci As New JwtConnectionInfo(key, secret)
Dim zc As New ZoomClient(ci)
Await zc.Users.UpdateAsync(user.EmailAddress, user.GivenName, user.Surname, user.Company, Nothing, Nothing, Nothing, user.Title, Nothing, user.PhysicalDeliveryOfficeName, Nothing, Nothing, Nothing, Nothing, Nothing, timezone, UserType.Basic)

The same code with the user type removed completes without issue:

Dim ci As New JwtConnectionInfo(key, secret)
Dim zc As New ZoomClient(ci)
Await zc.Users.UpdateAsync(user.EmailAddress, user.GivenName, user.Surname, user.Company, Nothing, Nothing, Nothing, user.Title, Nothing, user.PhysicalDeliveryOfficeName, Nothing, Nothing, Nothing, Nothing, Nothing, timezone)

It should also be mentioned that creating a user and including a user type works fine:

Dim ci As New JwtConnectionInfo(key, secret)
Dim zc As New ZoomClient(ci)
Dim zu As Models.User = Await zc.Users.CreateAsync(user.EmailAddress, user.GivenName, user.Surname, Nothing, Models.UserType.Basic)

The full stack trace is:

[ZoomException: Request Body should be a valid JSON object.]
   ZoomNet.Utilities.ZoomErrorHandler.OnResponse(IResponse response, Boolean httpErrorAsException) +416
   Pathoschild.Http.Client.Internal.<Execute>d__46.MoveNext() +1050
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Pathoschild.Http.Client.Internal.<AsMessage>d__37.MoveNext() +297
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Runtime.CompilerServices.TaskAwaiter.GetResult() +29
   foo.VB$StateMachine_103_SetZoomLicenseStatus.MoveNext() +1746
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +32
   foo.Controllers.VB$StateMachine_47_SetZoomLicenceType.MoveNext() +544
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +92
   System.Web.Mvc.Async.<>c__DisplayClass8_0.<BeginInvokeAsynchronousActionMethod>b__1(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0() +80
   System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +396
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__4() +50
   System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +188
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +43
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.InvokeEndHandler(IAsyncResult ar) +194
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +172
Jericho commented 1 year ago

Thanks for reporting this issue. I confirm that I am able to reproduce when I attempt to update my user's Type.

Jericho commented 1 year ago

:tada: This issue has been resolved in version 0.56.0 :tada:

The release is available on:

Your GitReleaseManager bot :package::rocket: