troubleshooting Question

Zoom's API call return error message

Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America asked on
ASP.NETC#Web Services
3 Comments1 Solution34 ViewsLast Modified:
The codes below are consuming zoom api and it works, however when issuccessful == false,
I want to know why and hope to return an error message that came from Zoom API.
Do you know how to capture error message?


public Zoom CreateRegistrant(Zoom z, Zoom.Registrant r, Zoom.Webinar w)
        {
            #region assign parameters into local parameters
            string htmlTemplate = string.Empty;
            Int64 webinarID = Convert.ToInt64(w.id);
            string first_name = r.first_name;
            string last_name = r.last_name;
            string email = r.email;
            string phone = r.phone;            
            dynamic obj = new
            {
                email = email,
                first_name = first_name,
                last_name = last_name,
                phone = phone
            };
            string jsonString = JsonConvert.SerializeObject(obj, Formatting.Indented);
            #endregion
            #region declare bridge
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var client = new RestSharp.RestClient("https://api.zoom.us/v2/webinars/" + webinarID + "/registrants");
            var request = new RestRequest(Method.POST);
            #endregion
            #region declare request API
            request.AddHeader("content-type", "application/json");
            request.AddHeader("authorization", z.authorization);
            request.AddParameter("application/json", jsonString, ParameterType.RequestBody);
            IRestResponse responseClass = client.Execute<Zoom.Webinar>(request);
            #endregion
            #region get response
            if (responseClass.IsSuccessful)
            {                                 
                var t1 = JsonConvert.DeserializeObject<Zoom.Webinar>(responseClass.Content);               
                z.isSuccessful = responseClass.IsSuccessful;
                w.join_url = t1.join_url;
                w.start_time = t1.start_time;
                w.topic = t1.topic;
                w.registrant_id = t1.registrant_id;
            }
            else
            {
                z.isSuccessful = false;
            }
            #endregion
            #region output
            return z;
            #endregion
        }
ASKER CERTIFIED SOLUTION
Louis LIETAER
System Infrastructure Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros