Zoom API: Unable to connect to the remote server

Hi, I’m currently creating a WebAPI that retrieves the details of a meeting via ASP .Net. But during production (Working fine during debug stage), I keep getting an error “Unable to connect to the remote server”.

// GET api/<controller>/5
        public HttpResponseMessage Get(long id)
        {
            var tokenHandler = new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler();
            var now = DateTime.UtcNow;
            var apiSecret = Global.API_SECRET; //-- API Secret--//
            byte[] symmetricKey = Encoding.ASCII.GetBytes(apiSecret);

            var tokenDescriptor = new SecurityTokenDescriptor
            {
                Issuer = Global.API_KEY, //-- API Key--//
                Expires = now.AddSeconds(300),
                SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(symmetricKey), SecurityAlgorithms.HmacSha256),
            };

            var token = tokenHandler.CreateToken(tokenDescriptor);
            var tokenString = tokenHandler.WriteToken(token);

            try
            {
                var responseString = "";
                var request = (HttpWebRequest)WebRequest.Create(String.Format("https://api.zoom.us/v2/report/meetings/{0}", id));

                request.Headers.Add("authorization", String.Format("Bearer {0}", tokenString));
                request.Method = "GET";
                request.ContentType = "application/json";

                using (var response1 = request.GetResponse())
                {
                    using (var reader = new StreamReader(response1.GetResponseStream()))
                    {
                        responseString = reader.ReadToEnd();
                    }
                }

                return Request.CreateResponse(HttpStatusCode.OK, responseString);
            }
            catch (Exception ex)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
            }
        }

Hey @soas_dev,

Thank you for reaching out to the Zoom Developer Forum. Do you have firewall rules on your production server that might be preventing your application from connecting to the API?

Thanks,
Max

1 Like

So I was able to resolve the issue by whitelisting the zoom api link on the server. Thank you!

Glad Max could help!