[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Has anybody had any experience accessing Google Apps web services from HTTPAPI?



> An example of an actual POST request using 2-legged OAuth

> POST /feeds/documents/private/full?xoauth_requestor_id=j.doe%40example.com HTTP/1.1
> Host: docs.google.com
> Content-Type: application/atom+xml
> Authorization: OAuth
> oauth_version="1.0",
> oauth_nonce="1c4fbbe4387a685829d5938a3d97988c",
> oauth_timestamp="1227303732",
> oauth_consumer_key="example.com",
> oauth_signature_method="HMAC-SHA1",
> oauth_signature="lqz%2F%2BfwtusOas8szdYd0lAxC8%3D"
> 
> <atom:entry xmlns:atom="http://www.w3.org/2005/Atom";>
>   <atom:category scheme="http://schemas.google.com/g/2005#kind";
>                  term="http://schemas.google.com/docs/2007#document"; />
>   <atom:title>Company Perks</atom:title>
> </atom:entry>


Assuming you know how to create the oauth_nonce and the oauth_signature...

This would be a somewhat strange POST_XML. Strange because it seems unusual to pass a parameter with the URL. If I read that correctly, everything up to the blank line is going to be "header" (cookies if they were cookies) keywords. This would be consistent with what I found with ClientLogin documentation. So, you need to build the URL and the additional headers.
 
Not tried but should go something like this:

Where = 'https://docs.google.com';
Path = '/feeds/documents/private/full?xoauth_requestor_id=';
Email = 'j.doe@xxxxxxxxxxx';

http_xproc( HTTP_POINT_ADDL_HEADER
             : %paddr(GDocsHeaders) );
postData = 
  '<atom:entry xmlns:atom="http://www.w3.org/2005/Atom";>' +
  '<atom:category scheme="http://schemas.google.com/g/2005#kind";' +
  ' term="http://schemas.google.com/docs/2007#document"; />' +
  '<atom:title>Company Perks</atom:title>' + 
  '</atom:entry>';

rc = http_post_xml( Where + Path + Email  
                  : %addr(postData) + 2                                  
                  : %len(postData)                              
                  : *null                                     
                  : %paddr(xmlReply)                          
                  : %addr(xmlReplyData)                              
                  : HTTP_TIMEOUT                              
                  : HTTP_USERAGENT                            
                  : 'application/atom+xml' );    


      P GDocsHeaders    B
      D GDocsHeaders    PI
      D   Header                    1024A   varying
      D   UserData                      *   value
       /free
          Header =  'Authorization: OAuth' + x'0d25'
                  + 'oauth_version="1.0",' + x'0d25'
                  + 'oauth_nonce="1c4fbbe4387a685829d5938a3d97988c",' + x'0d25'
                  + 'oauth_timestamp="1227303732",' + x'0d25'
                  + 'oauth_consumer_key="example.com",' + x'0d25'
                  + 'oauth_signature_method="HMAC-SHA1",' + x'0d25'
                  + 'oauth_signature="lqz%2F%2BfwtusOas8szdYd0lAxC8%3D"' + x'0d25';
       /end-free
      P                 E
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------