private void SendGetRequest(String url) { var request = requestFactory.Create(url); try { var response = request.Get(); response.Close(); } catch (VistarWebException ex) { if (ex.StatusCode == HttpStatusCode.BadRequest) { throw new InvalidLeaseException(); } else if (ex.StatusCode != HttpStatusCode.OK) { throw new ApiException(ex.Message); } } }
public void Send(string url) { var request = requestFactory.Create(url); try { var response = request.Post( string.Format("{{\"display_time\": {0}}}", DisplayTime.ToUtcUnixTime())); response.Close(); } catch (VistarWebException ex) { if (ex.StatusCode == HttpStatusCode.BadRequest) { throw new InvalidLeaseException(); } else if (ex.StatusCode != HttpStatusCode.OK) { throw new ApiException(ex.Message); } } }