Hi Jayakumar, It looks like you might be trying to send HTML to the service instead of URL encoded data; although, there certainly might be some Lua magic going on that I'm not aware of...
Based on syntax alone, I might expect the following: local request = "[email protected]&Passwd=north23AZ&service=health&source=Gulp- CalGulp-1.05" These parameters were taken from: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Request Also, you'll need to be sure to set the "Content-Type" header to "application/x-www-form-urlencoded". I don't believe that "Content- length" is required. If there are any URL tokens in your username or password, you'll need to be sure to percent encode before they're added to the request variable. If the request works, you should get a HTTP 200 with the ClientLogin token in the response body. I hope this helps! Paul On Oct 28, 4:49 am, Jayakumar <[email protected]> wrote: > Thank you very much Paul, > I tried to access the google health through a stand alone software. > So I have to use ClientLogin. > I tried to form the request with simple html and access ClientLogin I get > the response as said in the document, that is really great. > I tried the same through the script I get the 302 error. Please find the > code below > > local request = "<input type='text' name='accountType' > value='HOSTED_OR_GOOGLE'/><input type='text' name='Email' value=' > [email protected]'/><input type='text' name='Passwd' > value='xxxxx'/><input type='text' name='service' value='health'/><input > type='text' name='source' value='laird-APG-1'/>" > > local headers = { > ["Content-length"] = request:len(), > } > local result, statuscode, hdrs, statusline = http.request{ > url = "https://www.google.com/accounts/ClientLogin", > method = "POST", > headers = headers, > source = ltn12.source.string(request), > redirect = false, > > } > > Here redirect is set to false to avoid 301 and 302 error.(Ref > :http://w3.impa.br/~diego/software/luasocket/http.html) > > ------------------------ > Thanks & Regards, > Jayakumar > > > > > > > > On Sat, Oct 23, 2010 at 4:10 AM, Paul (Google) <[email protected]> wrote: > > Hi Jayakuman, > > > Welcome to the Health Developers' Forum! > > > If there isn't existing Lua code available for connection to Google > > Health, you'll probably want to start by reading the "feeds" and > > "protocol" sections of the Health API docs. These should help you to > > understand what HTTP requests Health supports and how the request and > > response contents are structured. > > >http://code.google.com/apis/health/docs/2.0/reference.html#Feeds > >http://code.google.com/apis/health/docs/2.0/developers_guide_protocol... > > > Paul (Google) > > > On Oct 20, 11:50 pm, Jayakumar <[email protected]> wrote: > > > Hi all, > > > I want to send my health details to my google health account. I am new to > > > this. I have an option to use only lua scripting. Can any one help me how > > to > > > do it. > > > > ------------------------ > > > Thanks & Regards, > > > Jayakumar > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Health Developers" group. > > To post to this group, send email to > > [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<googlehealthdevelopers% > > [email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/googlehealthdevelopers?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Health Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/googlehealthdevelopers?hl=en.
