0

I want to use Google Nuget package for shortening URLs. I included all the required files

 public string shortenIt(string url)
    {       
        UrlshortenerService service = new UrlshortenerService(new BaseClientService.Initializer()
        {
            ApiKey = "*************************",
            ApplicationName = "***************",
        });
        Url response = service.Url.Insert(new Url { LongUrl = url }).Execute();
        return response.Id;
    }

I am getting the following error on

  Url response = service.Url.Insert(new Url { LongUrl = url }).Execute();

Error:

  JsonReaderException: Error parsing NaN value. Path '', line 1, position 1 

I would be please to know the solution..Thanks

Shomaail
  • 493
  • 9
  • 30

1 Answers1

1

Google's URL shortener is no longer available, you should move to using Google's Firebase Dynamic Links.

Source: https://developers.googleblog.com/2018/03/transitioning-google-url-shortener.html

Ryan Sparks
  • 1,347
  • 14
  • 16