Google Freebase Api C # .Net Example

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

I'm just looking for a simple example of setting up an API connection, performing a search, and then how to process the MQL query back to the Json object. The simpler the better.

Thanks Scott

+4
source share
1 answer

The correct code for executing an 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 is now some error with the client library, as it does not return any results. I will try to find out what is happening there.

Update: The problem is that the client library passes through the alt = json parameter, which the Freebase API cannot support. The Python client library has a way to disable this, but there is no way to do it in .Net. You can follow the open error for this in the Google Code project.

+3
source

All Articles