It looks like you're trying to upload a document with both metadata and content. In that case, the request has to be MIME MULTIPART: http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html#UpdatingMetadataAndContent
Also, how are you getting around the cross domain issues? Eric On Jan 6, 12:36 am, senling <[email protected]> wrote: > Hi, > this is my code for creating new spreadsheet on google docs. > > // > ******************************************************************************** > var auths = > "DQAAAIMAAAD5CIREFWhKF3r26Crg.........DIu5Acu2etzurH9UT4EzkJZMg4W4W0PC4- > n3qWpokpq8Nk"; > > var mime,xml,doc,data; > > mime ="Content-Type: application/atom+xml\n\n"; > xml="<?xml version='1.0' encoding='UTF-8'?> <atom:entry > xmlns:atom=\"http://www.w3.org/2005/Atom\"> <atom:category scheme= > \"http://schemas.google.com/g/2005#kind\" term=\"http:// > schemas.google.com/docs/2007#document\"/> <atom:title>suraxls</ > atom:title> </atom:entry> "; > mime=mime + xml; > > http = new XMLHttpRequest(); > http.open("POST", "http://docs.google.com/feeds/ > documents/private/full?alt=json", true); > > http.onreadystatechange = OnUploadSpreadsheet; > http.setRequestHeader("Authorization", "GoogleLogin > auth=" + auths + ""); > http.setRequestHeader("Content-Length", mime.length); > http.setRequestHeader("Content-Type", "application/ > vnd.ms-excel"); > http.setRequestHeader("Slug", "suraBM.xls"); > > try{ > http.send(mime); > } > > catch(e) > { > alert("send error"); > } > > //******************************************************************** > > Authentication token : writely > Response : Could not convert document. > Status : 400 > > I always end up with this error....... > > This will be fine for Document and Text files. > > For spreadsheets and presentations, i encountered the same error.. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Docs Data APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Docs-Data-APIs?hl=en -~----------~----~----~----~------~----~------~--~---
