title: Google Firebase URL Shortener in C#
body: <p>I've been using the Google URL shortener for years, now I just receive a notification that the API will retire. I was not actively managing my code but now I need to :(</p>
  
  <p>Anyway, I have no clue how to change my code. I managed to get a new Google Firebase API key, but now?</p>
  
  <p>This is the guidance Google gives ... <a href="https://firebase.google.com/docs/dynamic-links/rest" rel="nofollow noreferrer">https://firebase.google.com/docs/dynamic-links/rest</a> ... right. Not much there, no coding examples ... I am not really a coder, so I am stuck already.</p>
  
  <p>This is my original code:</p>
  
  <pre><code>     string shorturl;
       string GoogleAPIkey = "mylittlesecret";
       var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url?key=" + GoogleAPIkey);
       httpWebRequest.ContentType = "application/json";
       httpWebRequest.Method = "POST";
       string longurl = "http://www.google.com";
  
       using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
  
              {
                  string json = "{\"longUrl\":\"" + longurl + "\"}";
                  streamWriter.Write(json);
              }
  
  
      var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
      using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
  
              {
                  var responseText = streamReader.ReadToEnd();
                  dynamic data = JObject.Parse(responseText);
                  shorturl = data.id;
              }
  
  
      Console.WriteLine("This is the short URL:" + shorturl);
  </code></pre>
  
  <p>Any guidance on how to get started?</p>