谷歌游离碱阿比C#.NET示例 [英] Google Freebase Api C# .Net Example

查看:176
本文介绍了谷歌游离碱阿比C#.NET示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Goolge的API的开发。我试图让Google.Apis.Freebase.V1 API工作在C#。有没有人对使用C#这个API的一个小例子?我花了过去几天的目光,只能找几个例子为老游离碱API。没有为谷歌API。

I am new to developing with the Goolge API’s. I am trying to get the Google.Apis.Freebase.V1 API working in C#. Does anyone have a small example on using this API in C#? I have spent the last several days looking and can only find a couple of examples for the old Freebase Api. Nothing for the Google API.

我只是在寻找有关设置的API连接,做一个搜索,那么如何处理MQL查询回一个JSON对象一个简单的例子。越简单越好。

I am just looking for a simple example on setting up a connection to the API, doing a search, then how to handle a MQL query back into a Json object. The simpler the better.

由于
斯科特

推荐答案

正确的代码使用谷歌API客户端库<做到在C#中MQL查询/ A>应该是这个样子:

The correct code to do a MQL query in C# using the Google API Client Library should look something like this:

string API_KEY = "your-api-key-here";
FreebaseService service = new FreebaseService{ Key = API_KEY };
String query = "[{\"id\":null,\"name\":null,\"type\":\"/astronomy/planet\"}]";
FreebaseService.MqlreadRequest request = service.Mqlread(query);
string response = request.Fetch();
Console.WriteLine (response);



不幸的是,似乎有某种与客户端库的错误,现在为不返回任何结果。我会尽力弄清楚是怎么回事有

Unfortunately, there seems to be some sort of error with the client library right now as its not returning any results. I'll try to figure out what's going on there.

更新:这个问题似乎是客户端库以及一个alt传递= JSON参数该游离碱API是无法支持。 Python客户端库有一个方法来禁用这一点,但有没有办法做到这一点在.NET。您可以按照为开放的bug 这对谷歌代码项目。

Update: The problem appears to be that the client library passes along an alt=json parameter which the Freebase API is unable to support. The Python client library has a way to disable this but there no way to do it in .Net. You can follow the open bug for this on the Google Code project.

这篇关于谷歌游离碱阿比C#.NET示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆