Saturday, 15 January 2011

parse error while creating folder on google-drive in qt(solved) -


I want to create a folder on the root (so I did not include the id field in it) but I get the error code 400, parse error. My code: This is that I have been able to do it in Qt:
  zero googled :: tryFolderCreate (QNetworkReply * Answer) {QByteArray d = reply-> ReadAll (); QDebug () & lt; & Lt; D; QString x = getValue (d, "access_token"); QDebug () & lt; & Lt; X; X = "bearer" + x; Am = new QNetworkAccessManager; Query url ("https://www.googleapis.com/drive/v2/files"); QNetworkRequest request; Request.setUrl (url); QByteArray data; Data.append ("{\" title \ ": \" images \ ", \ r \ n \" MIMETYPE \ ": \" application / vnd.google-apps.folder \ "} \ r \ n"); Request.setRawHeader (QString ("content type") toAscii (), QString ("application / json") toAscii () ..); Request.setRawHeader (QString ("authorization") toAscii (), x.toAscii ().); QDebug () & lt; & Lt; Data.data (); QObject :: Connect (am, signal (end (QNetworkReply *)), this, SLOT (uploadfinishedSlot (QNetworkReply *))); Am-> Post (request, data);   

}

You have no limit and file included The body looks like a proper body following the material body.

  post / upload / drive / v2 / files? UploadType = multipart HTTP / 1.1 host: www.googleapis.com Authority: your_auth_token Content-Type: multipart / related; Border = "foo_bar_baz" content-length: number_of_bytes_in_entire_request_body --foo_bar_baz Content-Type: Application / Jason; Charset = UTF-8 {"Title": "My File"} --foo_bar_baz Content-Type: Image / JPEG Blob Data --foo_bar_baz--   

This is already explained Please do not ask questions before reading available docs.

No comments:

Post a Comment