Google APIs .net 客户端库初体验

今天看到google api .net库的发布这条消息, 初步看了一下相关的内容,这个库对.net程序员和google服务的交互很是方便。

谷歌已经以开源形式发布了.NET APIs Client Library,开发者可通过此客户端库访问那些提供了可发现API的服务,例如Books(图书)、Analytics(分析)、Latitude(纵横或定位)、Prediction(预测)、Tasks(工作清单)、Translate(翻译),以及其他一些服务。

 http://code.google.com/p/google-api-dotnet-client/wiki/Downloads  可以下载源代码和例子

这些代码使用很是方便,具体步骤如下:

1、在 https://code.google.com/apis/console/#:access 或者

https://code.google.com/apis/console/b/0/#:access 获取oAuth认证信息和KEY

2、同时在以上地址开通相关的服务【否则不能使用,注意有收费的应用,免费的有次数限制】

3、代码中加入以上的信息,如下: 

        /// The OAuth2.0 Client ID of your project.
        public static readonly string ClientID = "<Enter your ClientID here>";
        /// The OAuth2.0 Client secret of your project.
        public static readonly string ClientSecret = "<Enter your ClientSecret here>";
        /// Your Api/Developer key.
        public static readonly string ApiKey = "<Enter your ApiKey here>";
4、编译例子程序可以体验Task(Tasks.WPF.ListTasks),Books(Books.ListMyLibrary)等各种应用

【注意:有些服务像Translate,以前都是免费的现在都收费了】

对于目前没有提供的服务,可以通过Gdata(google Data API)和服务交互 

Google Data API 提供用于在网络上读写数据的简单、标准协议。 Google 数据 API 可以使您的客户端应用程序与 Google 服务进行互动。

 http://code.google.com/intl/zh-CN/apis/gdata/index.html 

有了这些功能,我们在应用中可以集成使用,可以节省自己的开发运维成本,对于大的商业应用,支付一定的费用也是比较合适的选择。 

参考 :http://www.infoq.com/cn/news/2011/09/DOT-NET-API-Client-Library 

其他语言的库参考:

http://code.google.com/intl/zh-CN/apis/discovery/libraries.html 

原文地址:https://www.cnblogs.com/2018/p/2171843.html