//You may wish to replace this code with your preferred library for posting and receiving JSON data.
        private static RenewSessionResponse MakeWebRequest(string requestUrl, RenewSessionRequest request)
        {
            var webRequest = WebRequest.Create(requestUrl) as HttpWebRequest;

            webRequest.Method      = "POST";
            webRequest.ContentType = "application/json";

            var jsonSerializer = new JavaScriptSerializer();
            var requestStr     = jsonSerializer.Serialize(request);

            Debug.WriteLine(requestStr);

            using (var writer = new StreamWriter(webRequest.GetRequestStream()))
            {
                writer.Write(requestStr);
                writer.Close();
            }

            var response = webRequest.GetResponse() as HttpWebResponse;

            string jsonResult;

            using (var reader = new StreamReader(response.GetResponseStream()))
            {
                jsonResult = reader.ReadToEnd();
                reader.Close();
            }

            Debug.WriteLine(jsonResult);

            return(jsonSerializer.Deserialize <RenewSessionResponse>(jsonResult));
        }
        // token received from CreateSession API call
        public RenewSessionResponse RenewSecureToken(string secureToken)
        {
            const string renewSessionRequestUrl = "https://connect.gettyimages.com/v1/session/RenewSession";
            var          sessionToken           = new RenewSessionRequestBody
            {
                SystemId       = "systemId",
                SystemPassword = "******",
            };

            var renewSessionRequest = new RenewSessionRequest
            {
                RequestHeader = new RequestHeader {
                    Token = secureToken
                },
                RenewSessionRequestBody = sessionToken
            };

            return(MakeWebRequest(renewSessionRequestUrl, renewSessionRequest));
        }
        //You may wish to replace this code with your preferred library for posting and receiving JSON data.
        private static RenewSessionResponse MakeWebRequest(string requestUrl, RenewSessionRequest request)
        {
            var webRequest = WebRequest.Create(requestUrl) as HttpWebRequest;

            webRequest.Method = "POST";
            webRequest.ContentType = "application/json";

            var jsonSerializer = new JavaScriptSerializer();
            var requestStr = jsonSerializer.Serialize(request);

            Debug.WriteLine(requestStr);

            using (var writer = new StreamWriter(webRequest.GetRequestStream()))
            {
                writer.Write(requestStr);
                writer.Close();
            }

            var response = webRequest.GetResponse() as HttpWebResponse;

            string jsonResult;
            using (var reader = new StreamReader(response.GetResponseStream()))
            {
                jsonResult = reader.ReadToEnd();
                reader.Close();
            }

            Debug.WriteLine(jsonResult);

            return jsonSerializer.Deserialize<RenewSessionResponse>(jsonResult);
        }
        // token received from CreateSession API call
        public RenewSessionResponse RenewSecureToken(string secureToken)
        {
            const string renewSessionRequestUrl = "https://connect.gettyimages.com/v1/session/RenewSession";
            var sessionToken = new RenewSessionRequestBody
            {
                SystemId = "systemId",
                SystemPassword = "******",
            };

            var renewSessionRequest = new RenewSessionRequest
            {
                RequestHeader = new RequestHeader { Token = secureToken },
                RenewSessionRequestBody = sessionToken
            };

            return MakeWebRequest(renewSessionRequestUrl, renewSessionRequest);
        }