我是新来的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客户端库应该是这个样子:
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示例
发布评论