예제 #1
0
        public void GetMeetingParticipants(string MeetingId)
        {
            try
            {
                //Create new Request
                string         CBaseUrl         = String.Format("https://api.zoom.us/v2/report/meetings/{0}/participants?page_size=300", MeetingId);
                HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(CBaseUrl);
                myHttpWebRequest.Method      = "GET";
                myHttpWebRequest.ContentType = "application/json;";
                myHttpWebRequest.Accept      = "application/json;";
                myHttpWebRequest.Headers.Add("Authorization", String.Format("Bearer {0}", MyToken));

                //Get the associated response for the above request
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                using (StreamReader MyStreamReader = new StreamReader(myHttpWebResponse.GetResponseStream(), true))
                {
                    pResponse = JsonConvert.DeserializeObject <MeetingParticipants>(MyStreamReader.ReadToEnd());
                }

                myHttpWebResponse.Close();
                myHttpWebResponse.Dispose();
            }
            catch (WebException ex)
            {
                int errorCode = (int)((HttpWebResponse)ex.Response).StatusCode;
                if (errorCode != 0)
                {
                    ErrorCode = errorCode;
                    Stream            MyStream       = ex.Response.GetResponseStream();
                    StreamReader      MyStreamReader = new StreamReader(MyStream, true);
                    ZoomErrorResponse zm             = JsonConvert.DeserializeObject <ZoomErrorResponse>(MyStreamReader.ReadToEnd());
                    this.ZoomException = zm;
                }
            }
        }
예제 #2
0
        public void CreateZoomMeeting(MeetingRequest mRequest)
        {
            try
            {
                //Create new Request
                string         BaseUrl          = String.Format("https://api.zoom.us/v2/users/{0}/meetings", HostId);
                HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(BaseUrl);
                myHttpWebRequest.Method      = "POST";
                myHttpWebRequest.ContentType = "application/json;";
                myHttpWebRequest.Accept      = "application/json;";
                myHttpWebRequest.Headers.Add("Authorization", String.Format("Bearer {0}", MyToken));
                using (StreamWriter sw = new StreamWriter(myHttpWebRequest.GetRequestStream()))
                {
                    JsonSerializerSettings jss = new JsonSerializerSettings();
                    jss.Formatting            = Formatting.Indented;
                    jss.MissingMemberHandling = MissingMemberHandling.Ignore;
                    string json = JsonConvert.SerializeObject(mRequest, jss);

                    sw.Write(json);
                    sw.Flush();
                    sw.Close();
                }

                //Get the associated response for the above request
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                using (StreamReader MyStreamReader = new StreamReader(myHttpWebResponse.GetResponseStream(), true))
                {
                    mResponse = JsonConvert.DeserializeObject <MeetingResponse>(MyStreamReader.ReadToEnd());
                }
                myHttpWebResponse.Close();
                myHttpWebResponse.Dispose();
            }
            catch (WebException ex)
            {
                int errorCode = (int)((HttpWebResponse)ex.Response).StatusCode;
                if (errorCode != 0)
                {
                    ErrorCode = errorCode;
                    Stream            MyStream       = ex.Response.GetResponseStream();
                    StreamReader      MyStreamReader = new StreamReader(MyStream, true);
                    ZoomErrorResponse zm             = JsonConvert.DeserializeObject <ZoomErrorResponse>(MyStreamReader.ReadToEnd());
                    this.ZoomException = zm;
                }
            }
        }