Zoom validations #86
-
When adding a webinar registration I got an error: 'Validation Failed'. I eventually tracked it down to an invalid email address. (full-stop immediately after the @) When the Zoom API specifies a max-length for params does it spit it back if the length is exceeded, or does it just trim the input? My thinking is that if it's going to spit it back (with the ever helpful Validation Failed message) then perhaps ZoomNet should look at implementing those validations itself so users of it won't fall foul of this issue. My only concern with implementing the validations is if Zoom ever change them (lengthen or shorten the requirement). But it would still be easier to update ZoomNet once, rather than all projects that use it! When it comes to email addresses it's not something I want to get into validating. We've tried it before and there's always an edge-case somewhere so I'd rather leave it to Zoom. However, if the error message is that unhelpful then I'm probably going to have to do something! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You are absolutely correct that, currently, ZoomNet does not validate the input provided and the validation is delegated to the Zoom API. Before I present why I made this decision (and debating whether it was the right decision!), let me just describe how ZoomNet behaves when an error occurs, there may be information in there that might be useful to you. ZoomNet error handling When the Zoom API returns an error code, ZoomNet throws a
{
"code": 300,
"message": "This meeting has not registration required: 544993922"
} In this example, the 'Message' property will contain "This meeting has not registration required: 544993922". In your scenario, it sounds like you are, unfortunately, getting a very vague message like "Validation failed". Edit 2020-01-22: the error code has been added to the ZoomException class in ZoomNet 0.17.0.
Hopefully some of the information I just presented is helpful. Should validation be done client-side or server-side? This question, I'm sure, has been debated ever since developers started interacting with APIs. I don't know that there is a right or wrong answer but everyone has their opinion in this topic. Personally, I had to interact with a lot of APIs in my career and I have asked myself this question countless times. Earlier in my career I had a tendency to perform validation on the client-side because I felt it gave me more control but I faced several situations where the server-side logic would be updated and my client-side validation logic would no longer match which resulted in bugs, headaches, etc. That's the reason why at a certain point several years ago I changed my opinion and my current stance on this topic is that it's preferable to simply rely on the server-side logic. Generally, the argument in favor of client-side validation is: why allow a request to be sent to an API (which can be costly, it's a waste of resource and time, etc.) when this request will predictably fail. I sympathize with this point of view but in this case we are dealing with a 3rd party (Zoom in this case) which could decide at any moment to change their logic and they may or may not advertise the change so it can be difficult for us to keep up. Having said all this, I fully realize that we are debating opinions and everyone has their own view. I'm willing to keep an open mind and I can be persuaded to change my mind if there's a consensus that ZoomNet should perform more validation. |
Beta Was this translation helpful? Give feedback.
You are absolutely correct that, currently, ZoomNet does not validate the input provided and the validation is delegated to the Zoom API. Before I present why I made this decision (and debating whether it was the right decision!), let me just describe how ZoomNet behaves when an error occurs, there may be information in there that might be useful to you.
ZoomNet error handling
When the Zoom API returns an error code, ZoomNet throws a
ZoomException
and attempts to give you as much details as possible about what just occurred. Specifically, you can catch the exception and review the following properties:StatusCode
: this property is simply the HttpStatusCode of the response to your request…