Avatar of ITsolutionWizard
Flag for United States of America

asked on 

C# class to Zoom API

The following code is consuming Zoom API.
and I have two questions.

1. In Zoom, the response in json return settings. and Under settings it has audio, in_meeting and etc.
How should I construct the class to return the value?

2. var t1 = JsonConvert.DeserializeObject<Zoom>(response.Content), how can I loop all of the Zoom Class? Now I response.write one by one. using t1.class.

 public class Zoom
            public string agenta { get; set; }
            public string created_at { get; set; }
            public string duration { get; set; }
            public string host_id { get; set; }
            public string id { get; set; }
            public string join_url { get; set; }
            public string start_time { get; set; }
            public string start_url { get; set; }
            public string status { get; set; }
            public string timezone { get; set; }
            public string topic { get; set; }
            public string type { get; set; }
            public string uuid { get; set; }
            public string settings { get; set; }//has more child class

     protected void SubmitZoomAPIQuickTest_Click(object sender, EventArgs e)
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var client = new RestSharp.RestClient("https://api.zoom.us/v2/meetings/22321312312321?occurrence_id=1586358000000");
            var request = new RestSharp.RestRequest(RestSharp.Method.GET);
            request.AddHeader("authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhd42342343242342340RDNKbFEiLCJleHAiOjE1ODY5MTIxNjcsImlhdCI6MTU4NjMwNzM2OH0.v3 - IKSULeXjYZGvwTeWc9Hzw - ss2L8x4qq7BxK8iAQM");
            IRestResponse response = client.Execute(request);
            #region return class 
            IRestResponse responseClass = client.Execute<Zoom>(request);
                var t1 = JsonConvert.DeserializeObject<Zoom>(response.Content);
                Response.Write("Join URL:" + t1.join_url + "<br>"); 

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon