title: REST API health check
body: <p>I have number of APIs which is not being hosted by me, so I have no control of the API itself. What I'm trying to achieve is to check whether the APIs is online or not.I already tried several way:</p>
  
  <ol>
  <li>Sent a HTTP request to the API endpoint with HEAD method</li>
  <li><p>Sent a blank HttpWebRequest</p>
  
  <pre><code>HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
  using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
  {
      if (response.StatusCode == HttpStatusCode.NotFound)
          return false;
  
      return true;
  }
  </code></pre></li>
  <li><p>Ping the server</p></li>
  </ol>
  
  <p>But somehow my end result is not accurate enough. It shows offline but when I manually try to invoke the API, it seems okay. Anybody got a solution?</p>