c# - C# 中的 Google.Apis.Urlshortener 给出错误 JsonReaderException
问题描述
我想使用 Google Nuget 包来缩短 URL。我包括了所有必需的文件
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;
}
我收到以下错误
Url response = service.Url.Insert(new Url { LongUrl = url }).Execute();
错误:
JsonReaderException: Error parsing NaN value. Path '', line 1, position 1
我很想知道解决方案..谢谢
解决方案
Google 的 URL 缩短器不再可用,您应该转而使用 Google 的 Firebase 动态链接。
来源:https ://developers.googleblog.com/2018/03/transitioning-google-url-shortener.html
推荐阅读
- django - 可以在 Django 中为 slack slash command api mad 禁用 CSRF 吗?
- android - 用于数据发布的 react-native 中的表与 Listview
- java - 在 Spring Maven 项目中添加 web.xml
- java - 反射 - 使用 Long 和 Number 参数调用方法
- php - 如何在循环中访问 ["val1","val2","val3"] 等数组中的 PHP 值
- javascript - 点击时输入关闭列表,但不应该
- kotlin - 如何为 Kotlin 实施 applyif?
- docker - docker缓存内存一直在增加
- angular - 如何在下拉菜单中设置角度(全选)
- javascript - 当单击关闭按钮时,它应该停止使用 alertify 进行重定向?