Google data is good API tool for C# or other language to connect with Google related service, however here is no official Google Reader API on document. and Google data don’t support for Windows phone (only for Windows mobile for now).

However it could be found on web for some of unofficial document for Google Reader API as follows:

But however to come out detail implement for Windows Phone, it quit need time to work detail. Allow me try to list some major problems of this.

  • Most important of using HttpWebRequest is the error repose
> > The remote server returned an error: NotFound > >

It is most common error code your will find during you try to login or get any feedback on Window Phone. It could be either you missing your GET parameter or you missing your headers.

Here is some sample code related Login Google Reader and get list from this login. Some more detail communication code about HttpWebRequest, please check http://msdn.microsoft.com/zh-tw/library/system.net.webrequest.begingetrequeststream(v=vs.80).aspx

Something need to note before enter detail code.(check red part)

  • Need to authentication to get Auth_ID and SID for all API access.

  • Don’t miss your “Headers” when you trying to get API.

  • Http method need follow as document.

    public void LoginGoogleReader() { string email = “YOUR_EMAIL”; string passwd = “YOUR_PASSWORD”; string auth_params = string.Format(“https://www.google.com/accounts/ClientLogin?accountType=HOSTED_OR_GOOGLE&Email=” + email + “&Passwd=” + passwd + “&service=reader&source=J-MyReader-1.0”); HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(auth_params);

    httpRequest.Method = "POST";
            RequestState myRequestState = new RequestState();
            myRequestState.request = httpRequest;
            IAsyncResult result =
                (IAsyncResult)httpRequest.BeginGetResponse(new AsyncCallback(AuthRespCallback), myRequestState);
        }
    
        public void GetGoogleReaderPreferenceList()
        {
            string auth_params = string.Format("https://www.google.com/reader/api/0/preference/list?<font color="#ff0000">client=scroll&ck=1293954081436</font>");
    
    HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(auth_params);
    </br> httpRequest.Method = "GET"; httpRequest.Headers["Authorization"] = "GoogleLogin auth=" + UserAuth; httpRequest.Headers["Cookie"] = "SID=" + UserSid;
            RequestState myRequestState = new RequestState();
            myRequestState.request = httpRequest;
    
            IAsyncResult result =
                (IAsyncResult)httpRequest.BeginGetResponse(new AsyncCallback(AuthRespCallback), myRequestState);
        }
    

Buy Me A Coffee

Evan

Attitude is everything