restful gdocs

jbr - 2011-07-25

I tried to add a new function the the rest module in tcllib with this code:

 set gdocs(update) {
    method put
    body mime_multipart
    headers {
        GData-Version 3.0
        Authorization {GoogleLogin auth=%token%}
        Slug uploaded.txt
    opt_args { ocr: }

but I always get a 403 return code from google.

Here is the example usage that I tried:

 gdocs::set_static_args -token [gdocs::auth -Email [email protected] -Passwd ***********]
 set meta [gdocs::create_doc_metadata -title "pmacbino-axes.html" ]
 set root [lindex [gdocs::doclist] 0]
 foreach node [$root getElementsByTagName entry] {
    if { [[$node getElementsByTagName title] asText] eq "pmacbino-axes.html" } { set id [[$node getElementsByTagName id] asText]; break }

 set id [string map { {} } $id]

 gdocs::update -docid document%3A$id     \
        -- [list {Content-Type application/atom+xml} $meta] [list {Content-Type text/plain} "This is the text doc\n By john! Added this"]