Link to home
Start Free TrialLog in
Avatar of R1ND3R
R1ND3R

asked on

Examples on using Google Plus API

I am trying to output my post from my Google Plus account to another website. I have downloaded the Google .NET API dll's from http://code.google.com/p/google-api-dotnet-client/.

I've been trying to get my head around on how to use it. I know how to get a jSON output by using the Google API explorer here: http://code.google.com/apis/explorer. But since there is a .NET library from Google, I would like to use it to create a service.

Does anyone have any experience in getting data from Google+?
Avatar of Amandeep Singh Bhullar
Amandeep Singh Bhullar
Flag of India image

Googled and found the link, check if this can help you

http://www.googleplustips.com/resources/3332-NET-Library-Google-APIs-released.aspx
Use this link to get the help on google API or may be it will be helopful for you to develop any app

http://google-gdata.googlecode.com/svn/docs/Index.html
http://code.google.com/apis/gdata/articles/dotnet_client_lib.html
SOLUTION
Avatar of Navneet Hegde
Navneet Hegde
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of R1ND3R
R1ND3R

ASKER

This is what I have done so far using code sample's from the Google API site.

private static IAuthorizationState GetAuthorization(NativeApplicationClient arg)
        {
            // Get the auth URL:
            IAuthorizationState state = new AuthorizationState(new[] { TasksService.Scopes.Tasks.GetStringValue() });
            state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
            Uri authUri = arg.RequestUserAuthorization(state);

            // Request authorization from the user (by opening a browser window):
            Process.Start(authUri.ToString());
            Console.Write("  Authorization Code: ");
            string authCode = Console.ReadLine();
            Console.WriteLine();

            // Retrieve the access token by using the authorization code:
            return arg.ProcessUserAuthorization(authCode, state);
        }


        private void GetProfileInfo()
        {
            var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);
            provider.ClientIdentifier = "123456.apps.googleusercontent.com";
            provider.ClientSecret = "<..someclientsecret..>";
            var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);

            var service = new PlusService(auth);

            var result = service.People.Get("103697821787469756035");            

        }

Open in new window


But I am getting the following error on this line:
var service = new PlusService(auth);

Open in new window


The error message is:

"The type initializer for 'Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception."
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of R1ND3R

ASKER

The code I have written one of  my previous posts should help someone else who wants to start using Google+ API