Gau-Yi / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Updating an existing document in google docs. #149

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which API and version (e.g. Google Calendar Data API version 2)?
Google Docs Data API version 3

What format (e.g. JSON, Atom)?
Atom

What Authentation (e.g. OAuth, OAuth 2, Android, ClientLogin)?
I am not sure of this, but I follow the example of the 
'picasa-atom-android-sample' example.

Java environment (e.g. Java 6, Android 2.3, App Engine 1.4.2)?
Android 2.2

External references, such as API reference guide?
protocol

Please provide any additional information below.
Though I try with the following code snippet(pasted below) I get a 200OK but 
still the doc(text/plain) is NOT updated from my local phone.

            try {
                HttpRequest requestPost = transport.buildPutRequest();
                requestPost.url = DocsUrl.forUploadingFile(editLink);
                ((GoogleHeaders) requestPost.headers).setSlugFromFileName("books1.xml");
                InputStreamContent content = new InputStreamContent();
                File file = new File("//sdcard/books.xml");
                content.setFileInput(file);
                content.type = "text/plain";
                content.length = file.length();
                System.out.println("Length of the file = "+content.length);
                requestPost.content = content;

                HttpResponse  responseUpload = requestPost.execute();
                System.out.println("Uploading code = "+responseUpload.statusCode);

            } 
            catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            catch (ClientProtocolException e) {
                System.out.println("Client Protocol Exception");
            }
            catch (IOException e) {
                handleException(e);
            }

Original issue reported on code.google.com by syedsana...@gmail.com on 14 Mar 2011 at 4:04

GoogleCodeExporter commented 9 years ago
Where did you get DocsUrl class? i cant see any in my library :(

Original comment by bensio...@gmail.com on 6 Mar 2012 at 10:05