Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag 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);
            if(responseClass.IsSuccessful)
            {
                var t1 = JsonConvert.DeserializeObject<Zoom>(response.Content);
                Response.Write("Setting:"+t1.settings+"<br>");
                Response.Write("Join URL:" + t1.join_url + "<br>"); 
            }
            #endregion 
        }

Open in new window

Avatar of ITsolutionWizard
ITsolutionWizard
Flag of United States of America image

ASKER

any helps?
Avatar of srikanthreddyn143
srikanthreddyn143

Get the full json and use below link to generate POCO class

http://json2csharp.com/
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial