Sunday, January 01, 2012

Google API using cURL or wget or plain http

I was researching to use Google API for certain activities.
There are 2 kinds of access
  1. oauth 
  2. clientlogin (username and password) 
I am mostly interested in clientlogin.

Client Login:

Thing to Note:
  1.     Service Type: More here http://code.google.com/apis/gdata/faq.html#clientlogin for contacts, service type is "cp"
  2. There are 2 request to fetch the actua value
    1. First Request URL:  curl https://www.google.com/accounts/ClientLogin --data-urlencode Email=YOURID@gmail.com --data-urlencode Passwd=PASSWORD -d accountType=GOOGLE -d source=Google-cURL-Example -d service=cp
    2. Response for the above Request will be: SID=DQ...........A
      LSID=EUBBBIaBADCl...........2JKOuGh
    3. Make second Request by using Auth param from the above response: 
      1. curl --silent --header "Authorization: GoogleLogin auth=AUTH_TOKEN_FROM_ABOVE_RESPONSE" "https://www.google.com/m8/feeds/contacts/YOURID@gmail.com/full"
       
  3. Second response will be the address details, thats it. 





No comments:

Post a Comment

Thanks for reading and welcome for commenting...