网址:https://developers.google.com/drive/v2/reference/realtime/update
我想将实时文件A复制到REaltime文件B.现在我已成功调用https://developers.google.com/drive/v2/reference/realtime/get从文件A获取JSON数据。
但是我没有调用update来将数据更新到文件B,返回错误:
{"错误" {"代码":500,消息":空}}
任何人都可以帮助我吗?这是我的代码:
make_request=function(params, callback) {
params['callback'] = function(data){
if (callback != null) { callback(data); }
return gapi.client.request(params);
}
content=localStorage["realtimeA data"];
boundary = "-------314159265358979323846";
delimiter = "\r\n--" + boundary + "\r\n"; close_delim = "\r\n--" + boundary + "--"; base64Data = btoa(content);
multipartRequestBody = delimiter + "Content-Type: " + "application/json" + "\r\n" + 'Content-Transfer-Encoding: base64\r\n' + "\r\n" + base64Data + close_delim;
params = {
path: "/upload/drive/v2/files/0B4ihvYUW4AU1WEQyRTEwaGRNaXM/realtime",
method: "PUT",
params: { uploadType: "media", fileId: "0B4ihvYUW4AU1WEQyRTEwaGRNaXM" },
headers: { "Content-Type": "multipart/mixed; boundary=\"" + boundary + "\"" },
body: multipartRequestBody
};
make_request(params,function callback(data){alert(JSON.stringify(data));} );