Shomaail
Shomaail

Reputation: 493

Google.Apis.Urlshortener in C# giving Error JsonReaderException

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

Upvotes: 0

Views: 363

Answers (1)

Ryan Sparks
Ryan Sparks

Reputation: 1376

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

Upvotes: 1

Related Questions