Cannnot upload a document

158 views
Skip to first unread message

Igor Grivko

unread,
Mar 29, 2012, 5:58:22 AM3/29/12
to google-docum...@googlegroups.com
Hi All,

Today I always get an error while trying to upload a document via API 3.0:

ERROR: 203 "Error downloading https://docs.google.com/feeds/upload/create-session/default/private/full/document%3A1c9OVAZlhvbbvIN547bC15N1InbijIwQ6S7GV9sC1cS0 - server replied: Not Found" , statusCode= 404


It seems that I cannot create a session using edit-resumable-link.


Can you look at this?


Best regards,

Igor Grivko


Igor Grivko

unread,
Mar 29, 2012, 1:54:53 PM3/29/12
to google-docum...@googlegroups.com
Anybody can comment on this? For some unknown reason the server cannot find an "edit-resumable-link".
It seems like a bug.

Alain Vongsouvanh

unread,
Mar 29, 2012, 2:39:08 PM3/29/12
to google-docum...@googlegroups.com
Hello Igor,

Is this error occurring for all documents (including new ones)? Can you share with us the code you are using to accomplish the upload request?

Thanks!
Alain
--
Alain Vongsouvanh | Developer Programs Engineer

Igor Grivko

unread,
Mar 29, 2012, 4:23:01 PM3/29/12
to google-docum...@googlegroups.com
Hi Alain,

I am developing a Qt application (it is a C++ code). Today I found that code that worked pretty good gives me always a 404 error.
May be it is my fault - but I cannot find anything wrong.

It happens with all documents (even newly created) - the same behavior - 404 Error.

Here are the values of the initial request for file uploading. I am uploading the file contents only, not changing meta data.

URL QUrl( "https://docs.google.com/feeds/upload/create-session/default/private/full/document%3A1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls" )

Headers:

"GData-Version" "3.0"

"Authorization" "OAuth ya29.AHES6ZTNaUXFNziw9wdqV2UpcLdSQz07klNraaQuv0nq9FCu5B9Uhf4"

"If-Match" "*"

"Content-Type" "application/msword"

"Content-Length" "11776"

"X-Upload-Content-Type" "application/msword"

"X-Upload-Content-Length" "11776"


This very QNetworkRequest is sent via m_pNetworkAccessManager->put(request, QByteArray()); //Empty body of request.
Can you reproduce the problem? May be I need to fix my code?

Thanks in advance,
Igor Grivko

Ali Afshar

unread,
Mar 29, 2012, 4:39:03 PM3/29/12
to google-docum...@googlegroups.com
Hi Igor,

This is still wrong, I am afraid. Your initial request should not have a Content-Type or a Content-Length header. Those should be present for the successive requests.

Regards
--
Ali Afshar | www.googplus.org/ali | Google Developer Relations

Alain Vongsouvanh

unread,
Mar 29, 2012, 4:47:58 PM3/29/12
to google-docum...@googlegroups.com
Hello Igor,

In addition to what Ali said, please make sure to revoke the tokens you just pasted so that nobody can use them.

Best,
Alain

Igor Grivko

unread,
Mar 29, 2012, 4:54:56 PM3/29/12
to google-docum...@googlegroups.com
Hi Ali,

First of all, check the documentation, that is from where I got this idea. If it is wrong, it must be fixed ASAP, don't you agree?

"""""""""""

Updating document or file content with the resumable protocol

Similar to initiating a resumable upload session, you can utilize the resumable upload protocol to replace an existing document's content. To start a resumable update request, send an HTTP PUT to the entry link with rel attribute resumable-edit-media. Each document or file entry that the currently authorized user has permission to update will contain a resumable-edit-media link.

<link rel="http://schemas.google.com/g/2005#resumable-edit-media" type="application/atom+xml"
   
href="https://docs.google.com/feeds/upload/create-session/default/private/full/document%3A12345"/>

Here is the initial request:

PUT https://docs.google.com/feeds/upload/create-session/default/private/full/document%3A12345
Authorization: <your authorization header here>
If-Match: <ETag or * here>
Content-Length: 1000
Content-Type: text/plain
X
-Upload-Content-Length: 1000
X
-Upload-Content-Type: text/plain

<empty body>

""""""""""""""""""""""""



Then, I removed Content-Type and Content-Length (as you advised me) - the result is the same, sorry.

"Authorization" "OAuth ya29.AHES6ZRVt37JDAC60jgWPAYKi5csK2eJZxFzbn5KupGOmYzogzloQbI"

"If-Match" "*"

"X-Upload-Content-Type" "application/msword"

"X-Upload-Content-Length" "11776"

DATA: ""

void DocsDataManager::replyFinished(QNetworkReply*)

Before handleReply

uploadFileFinished

Reply with the error!!!!!

ERROR: 203 "Error downloading https://docs.google.com/feeds/upload/create-session/default/private/full/document%3A1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls - server replied: Not Found" , statusCode= 404

#######################REPLY = ""

#######################END REPLY



Best regards,
Igor Grivko

Alain Vongsouvanh

unread,
Mar 29, 2012, 5:17:33 PM3/29/12
to google-docum...@googlegroups.com
Hello Igor,

According to the documentation available here:

The first request to the create-media URL must be a POST request with no content. The server will then reply with another URL to which media upload requests can be sent.


POST [resumable-create-media link]
Content-Length: 0
X
-Upload-Content-Type: application/pdf
X
-Upload-Content-Length: 1073741824
HTTP
/1.1 200 OK
Location: [next location]
...

PUT
[next location]
Content-Length: 524288
Content-Type: application/pdf
Content-Range: bytes 0-524287/1073741824

[bytes 0-524287]
HTTP
/1.1 308 Resume Incomplete
Range: 0-524287
Location: [next location]
...

Best,
Alain

Igor Grivko

unread,
Mar 29, 2012, 5:39:11 PM3/29/12
to google-docum...@googlegroups.com
Hi Alain,

Sorry, I am uploading a new "EDITION" of the existing file - so it has nothing to do with resumable-create-media link.
Instead, I am using edit-resumable-media link. And this request starts from PUT - I cannot help it. (see documentation cite I sent before).

I tried to send a POST request, though.

+++++++++++++++uploadFile, id = +++ "1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls"

resumable_edit_media "https://docs.google.com/feeds/upload/create-session/default/private/full/document%3A1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls"

QString FileTools::getContentTypeByExtension(const QString&) "doc"

+++contentType = "application/msword"

void DocsDataManager::replyFinished(QNetworkReply*)

Before handleReply

uploadFileFinished

File to upload!!! "/home/grivna/GoogleDocs/igor.grivko_gmail.com/Created_in_Google-2.doc" location "https://docs.google.com/feeds/upload/create-session/default/private/full/document%253A1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls?upload_id=AEnB2UqKKEyuU-x_0za7GFEf6GjmOwAJGwGggtvta_MdscsAw9G_mReRvTL1W4og_frdFuFFNTZlcUrSh-t3IPbWWntdbNe_tg"

QString FileTools::getContentTypeByExtension(const QString&) "doc"

URL QUrl( "https://docs.google.com/feeds/upload/create-session/default/private/full/document%253A1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls?upload_id=AEnB2UqKKEyuU-x_0za7GFEf6GjmOwAJGwGggtvta_MdscsAw9G_mReRvTL1W4og_frdFuFFNTZlcUrSh-t3IPbWWntdbNe_tg" )

Headers:

"GData-Version" "3.0"

"Authorization" "OAuth XXXXXXXXXXXXXXXXXXXXXXXXXXXX"

"Content-Type" "application/msword"

"Content-Length" "12800"

"Content-Range" "bytes 0-12799/12800"

DATA: "ÐÏ à¡± á

void DocsDataManager::replyFinished(QNetworkReply*)

Before handleReply

uploadFileFinished

Reply with the error!!!!!

ERROR: 301 "Error downloading https://docs.google.com/feeds/upload/create-session/default/private/full/document%253A1ZyBLRkQVtm3f7wroLmXlCWMbC522LsVb1twY5Tmu5ls?upload_id=AEnB2UqKKEyuU-x_0za7GFEf6GjmOwAJGwGggtvta_MdscsAw9G_mReRvTL1W4og_frdFuFFNTZlcUrSh-t3IPbWWntdbNe_tg - server replied: Not Implemented" , statusCode= 501

#######################REPLY = "<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>noPostConcurrency</code><internalReason>POST method does not support concurrency</internalReason></error></errors>"

#######################END REPLY



It seems that now I was able to move a little further, but the second request failed anyway.

Best regards,
Igor Grivko

Alain Vongsouvanh

unread,
Mar 29, 2012, 7:04:34 PM3/29/12
to google-docum...@googlegroups.com
Hello Igor,

Sorry about the confusion, there was indeed an issue in a recent release that is currently being rolled-back. I don't have an ETA as to when the roll-back should be complete but it should be resolve soon.
I will post back when I have more information.

Best,
Alain
Reply all
Reply to author
Forward
0 new messages