Anyone ? TIA, Stéphane
On 28 nov, 10:16, sdevouard <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using the Google Spreadsheet API to create spreadsheets on Google > Docs from my application. > Since I'm not using any of the languages for which Google provides a > set of client classes, I'm using the low-level interface sending HTTP > requests and parsing the Atom responses. > My HTTP client routine does not allow for multi-parts content, thus to > create the spreadsheet, I first send a POST request with only > metadata, retrieve the edit-media link HREF from the response, then > PUT the actual file content to this URL. > The Google API answers with a 400 Bad Request status & "Could not > convert document" error message to my PUT request, and I'm at a loss > to determine what's wrong with it. > Below is a trace debug output of what I send to and what I receive > from Google : > > open> [tcp]docs.google.com;80;STREAM > send> PUT /feeds/media/private/full/ > spreadsheet:p3HB92QDh9kqpgmZuITdBLw HTTP/1.1 > send> Host: docs.google.com:80 > send> From: [EMAIL PROTECTED] > send> User-Agent: ProvideX HTTP Agent > send> Content-Type: text/csv; charset=us-ascii > send> Content-Length: 11046 > send> Authorization: GoogleLogin > auth=DQAAAHsAAADW2Av0QZeG5bHJkM5828eMtdRLywuq28dItoSrPP9TwLksnEhcwk6vAwosZVudULwQ3S9I5sEE9PfiPh4Ig4rR30zq3n92TviKjHz4igmkkVLs1ofy-6S1L9QSA6lmTZTJ9GuL9zGIfjuPjcidlOca87KvfC- > vfvPWtJj3RA_6gA > send> GData-Version: 2 > send> If-Match: * > send> Connection: close > send> > send> "Invoice","Job/Memo","Date","DueWk","Stat","Amount","HB/Pay/ > Adjs","Amount Due" > send> "HR-R100007","","2008/06/21","0838","",-41.25,0,-41.25 > send> "HR-R100007 R","","2008/06/21","0838","",41.25,0,41.25 > send> "HR-R100014","","2008/06/28","0838","",-83.51,0,-83.51 > send> "HR-R300159","","2008/03/25","0824","",-19.8,19.8,0 > send> "SP-R000004","","2008/05/15","0833","",-358.32,0,-358.32 > send> "SP-R000006","","2008/06/15","0838","",-358.32,0,-358.32 > send> "HR-u100008","","2008/06/19","0838","",-162,0,-162 > send> "HR-u100014","","2008/06/28","0838","",-264.44,0,-264.44 > send> "HR-u300154","","2008/03/25","0824","",-2201.04,0,-2201.04 > send> "HR-u800005","","2008/06/19","0838","",-72.99,0,-72.99 > send> "SP-t000004","","2008/05/15","0833","",-108,0,-108 > send> "SP-t000006","","2008/06/15","0838","",-108,0,-108 > send> "HR-t100007","","2008/06/21","0838","",-10.78,0,-10.78 > send> "HR-t100007 R","","2008/06/21","0838","",10.78,0,10.78 > send> "HR-u100009","","2008/06/20","0838","",0,0,0 > send> "AB-1100151","","2008/01/01","0816","",-286.74,0,-286.74 > send> "AB-1200151","","2008/01/01","0816","",-286.74,0,-286.74 > send> "AB-1300151","","2008/01/01","0816","",-286.74,0,-286.74 > send> "AB-1400151","","2008/01/01","0816","",-286.74,0,-286.74 > send> "AB-1500151","","2008/01/01","0816","",-286.74,0,-286.74 > send> "HR-M100007","","2008/06/21","0838","",-20.34,0,-20.34 > send> "HR-M100007 R","","2008/06/21","0838","",20.34,0,20.34 > send> "HR-M100014","","2008/06/28","0838","",-42.6,0,-42.6 > send> "HR-M300151","","2008/01/01","0816","",-286.74,0,-286.74 > send> "HR-M300153","","2008/01/03","0816","",-95.58,0,-95.58 > send> "HR-M300154","","2008/03/25","0824","",-379.84,0,-379.84 > send> "HR-M300156","","2008/03/25","0824","",-131.42,0,-131.42 > send> "HR-M300157","","2008/03/25","0824","",-60.9,0,-60.9 > send> "HR-M300158","","2008/03/25","0824","",-28.92,0,-28.92 > send> "HR-M300159","","2008/03/25","0824","",-14.36,0,-14.36 > send> "HR-S100007","","2008/06/21","0838","",-86.96,0,-86.96 > send> "HR-S100007 R","","2008/06/21","0838","",86.96,0,86.96 > send> "HR-S100014","","2008/06/28","0838","",-182.16,0,-182.16 > send> "HR-S300151","","2008/01/01","0816","",-1226.1,0,-1226.1 > send> "HR-S300153","","2008/01/03","0816","",-408.7,0,-408.7 > send> "HR-S300154","","2008/03/25","0824","",-1624.16,0,-1624.16 > send> "HR-S300156","","2008/03/25","0824","",-561.96,0,-561.96 > send> "HR-S300157","","2008/03/25","0824","",-260.4,0,-260.4 > send> "HR-S300158","","2008/03/25","0824","",-123.7,0,-123.7 > send> "HR-S300159","","2008/03/25","0824","",-61.38,0,-61.38 > send> "HR-T100007","","2008/06/21","0838","",-65.87,0,-65.87 > send> "HR-T100007 R","","2008/06/21","0838","",65.87,0,65.87 > send> "HR-T100014","","2008/06/28","0838","",-273.05,0,-273.05 > send> "HR-T300151","","2008/01/01","0816","",-2690.26,0,-2690.26 > send> "HR-T300153","","2008/01/03","0816","",-801.29,0,-801.29 > send> "HR-T300154","","2008/03/25","0824","",-3930.62,0,-3930.62 > send> "HR-T300156","","2008/03/25","0824","",-1209.17,0,-1209.17 > send> "HR-T300157","","2008/03/25","0824","",-424.02,0,-424.02 > send> "HR-T300158","","2008/03/25","0824","",-135.42,0,-135.42 > send> "HR-T300159","","2008/03/25","0824","",-37.08,0,-37.08 > send> "HR-U100007","","2008/06/21","0838","",-5.61,0,-5.61 > send> "HR-U100007 R","","2008/06/21","0838","",5.61,0,5.61 > send> "HR-U100008","","2008/06/19","0838","",-14.4,0,-14.4 > send> "HR-U100009","","2008/06/20","0838","",-6,0,-6 > send> "HR-U100014","","2008/06/28","0838","",-11.75,0,-11.75 > send> "HR-U300151","","2008/01/01","0816","",-79.1,0,-79.1 > send> "HR-U300153","","2008/01/03","0816","",-3.26,0,-3.26 > send> "HR-U300154","","2008/03/25","0824","",-9.2,0,-9.2 > send> "HR-U300157","","2008/03/25","0824","",-16.8,0,-16.8 > send> "HR-U300158","","2008/03/25","0824","",-7.98,0,-7.98 > send> "HR-U300159","","2008/03/25","0824","",-3.96,0,-3.96 > send> "HR-U800005","","2008/06/19","0838","",-6.49,0,-6.49 > send> "SP-M000004","","2008/05/15","0833","",-173.2,0,-173.2 > send> "SP-M000006","","2008/06/15","0838","",-173.2,0,-173.2 > send> "SP-S000004","","2008/05/15","0833","",-740.52,0,-740.52 > send> "SP-S000006","","2008/06/15","0838","",-740.52,0,-740.52 > send> "SP-T000004","","2008/05/15","0833","",-891.11,0,-891.11 > send> "SP-T000006","","2008/06/15","0838","",-891.11,0,-891.11 > send> "SP-U000004","","2008/05/15","0833","",-47.78,0,-47.78 > send> "SP-U000006","","2008/06/15","0838","",-47.78,0,-47.78 > send> "5","","2007/04/01","0728","",-2000,0,-2000 > send> "5CR","","2007/04/01","0728","",2000,0,2000 > send> "6","","2007/04/01","0728","",-2000,0,-2000 > send> "6CR","","2007/04/01","0728","",2000,0,2000 > send> "1","","2007/04/01","0728","",-1315,0,-1315 > send> "11","","2007/04/23","0728","",-1315,1315,0 > send> "12","","2007/04/24","0728","",-1315,1315,0 > send> "1CR","","2007/04/01","0728","",1315,0,1315 > send> "2","","2007/04/01","0728","",-1200,0,-1200 > send> "2CR","","2007/04/01","0728","",1200,0,1200 > send> "3","","2007/04/01","0728","",-1315,0,-1315 > send> "3CR","","2007/04/01","0728","",1315,0,1315 > send> "4","","2007/04/01","0728","",-1200,0,-1200 > send> "4CR","","2007/04/01","0728","",1200,0,1200 > send> "SYL1","","2007/04/01","0728","",-1315,0,-1315 > send> "SYL1CR","","2007/04/01","0728","",1315,0,1315 > send> "SYL2","","2007/04/01","0728","",-1315,0,-1315 > send> "SYL2CR","","2007/04/01","0728","",1315,0,1315 > send> "34-34-55","test1","2008/06/23","30838","",-77,0,-77 > send> "34-99-22","Test 99","2008/06/23","30838","",-44,0,-44 > send> "43829","","2008/02/22","30820","",-2222,0,-2222 > send> "56373","TESAD","2008/03/13","30824","",55,0,55 > send> "67-890","0000094","2008/01/23","30816","",-345,0,-345 > send> "737","01-0001","2007/05/11","30733","",-1000,0,-1000 > send> "739","01-0001 0000505","2007/05/11","30733","",-1040,0,-1040 > send> "741","0000506","2007/05/11","30733","",-234,0,-234 > send> "742","01-0001 0000506","2007/05/11","30733","",-234,0,-234 > send> "89-89","01-2345 test 7","2008/06/23","30838","",-99,0,-99 > send> "TESTREG","","2007/05/07","30733","",-1000,1000,0 > send> "0005","01-0001","2007/05/25","0733","",-1090,0,-1090 > send> "002","01-0001","2007/03/31","T0720","",-61225,0,-61225 > send> "004","01-0001 MEMO ME > MEMO","2007/05/01","0733","",-1090,0,-1090 > send> "005","01-0001","2007/05/18","0733","",-1090,0,-1090 > send> "006","01-0001","2007/05/25","0733","",-109,0,-109 > send> "007","","2007/05/25","0733","",200,0,200 > send> "008","01-0001","2007/05/25","0733","",-1040,0,-1040 > send> "009","01-0001","2007/05/25","0733","",-1199,0,-1199 > send> "010","01-0001","2007/06/15","0733","",-2180,0,-2180 > send> "011","01-0001","2007/06/18","0737","",-218,0,-218 > send> "011CR","01-0001","2007/06/18","0737","",218,0,218 > send> "012","01-0001","2007/06/01","0737","",-109,0,-109 > send> "654999-002","01-0001","2007/03/31","0724","",-1040,0,-1040 > send> "654999-002CR","01-0001","2007/03/31","0724","",1040,0,1040 > send> "654999-003","","2007/05/17","0733","",0,0,0 > send> "654999-004","01-0001","2007/05/23","0733","",-1090,100,-990 > send> "125","","2008/06/01","T0833","",-1500,1500,0 > send> "5155","","2008/07/03","T0838","",-66,66,0 > send> "665","","2008/06/19","0838","",-3000,3000,0 > send> "222","","2008/07/15","0842","",-654,654,0 > send> "TESTREG","","2007/05/07","0733","",-1000,1000,0 > send> "100","0000503","2008/07/10","X0834","",-5,0,-5 > send> "10001","01-0001","2007/06/01","X0729","",-1045,0,-1045 > send> "1001","01-0001","2007/05/01","X0724","",-1100,0,-1100 > send> "1001DISC","01-0001","2007/05/01","X0724","",-1100,5,-1095 > send> "1001HB","01-0001","2007/05/01","X0724","",-1100,110,-990 > send> "1002","01-0001","2007/05/01","X0724","",-1100,1100,0 > send> "1002DISC","01-0001","2007/05/01","X0724","",-1100,5,-1095 > send> "1002HB","01-0001","2007/05/01","X0724","",-1100,110,-990 > send> "1003","01-0001","2007/05/01","X0724","",-1000,0,-1000 > send> "1003A-HB","01-0001","2007/05/01","X0724","",-1000,100,-900 > send> "1003DISC","01-0001","2007/05/01","X0724","",-1000,5,-995 > send> "1003HB","01-0001","2007/05/01","X0724","",-1000,100,-900 > send> "1004","01-0001","2007/05/01","X0724","",-1050,0,-1050 > send> "1004CR","01-0001","2007/05/01","X0724","",1050,0,1050 > send> "1004SPLIT","01-0001","2007/05/01","X0724","",-1000,0,-1000 > send> "103","0000132","2008/07/10","X0834","",-77,0,-77 > send> "106","0000132","2008/07/10","X0834","",-55,0,-55 > send> "108","0000132","2008/07/10","X0834","",-330,0,-330 > send> "110","*","2008/07/10","X0834","",-5,0,-5 > send> "1101","01-0001","2007/05/12","X0726","",-1045,0,-1045 > send> "112","0000132","2008/07/10","X0834","",-1155,0,-1155 > send> "115","0000132","2008/07/10","X0834","",-800,0,-800 > send> "116","0000132","2008/07/10","X0834","",-198,0,-198 > send> "123","01-0001","2007/06/19","X0731","",-1045,0,-1045 > send> "123SUSPENSE","01-0001","2007/05/03","X0724","",-1025,0,-1025 > send> "2001","01-0001","2007/05/02","X0724","",-200,0,-200 > send> "2002","01-0001","2007/05/02","X0724","",-300,0,-300 > send> "2003","01-0001","2007/05/02","X0724","",-600,0,-600 > send> "34","0000132","2008/07/10","X0834","",-2500,2500,0 > send> "5001","01-0001","2007/05/16","X0726","",-1090,0,-1090 > send> "5002","01-0001","2007/05/16","X0726","",-1000,0,-1000 > send> "5003IC","01-0001","2007/05/16","X0726","",-1000,0,-1000 > send> "55","0000132","2008/07/10","X0834","",-346500,0,-346500 > send> "6001","01-0001","2007/05/18","X0727","",-1045,0,-1045 > send> "7001","","2007/05/07","X0725","",-1000,1000,0 > send> "7002","","2007/05/07","X0725","",-1050,1050,0 > send> "7003","","2007/05/07","X0725","",-100,100,0 > send> "7004","","2007/05/07","X0725","",-200,200,0 > send> "7005","","2007/05/07","X0725","",-2100,2100,0 > send> "7006","0000502","2007/05/09","X0725","",-1050,0,-1050 > send> "7007","0000503","2007/05/09","X0725","",-10.5,0,-10.5 > send> "7007CR","0000503","2007/05/09","X0725","",10.5,0,10.5 > send> "7008","0000504","2007/05/09","X0725","",-152.5,0,-152.5 > send> "7008CR","0000504","2007/05/09","X0725","",152.5,0,152.5 > send> "7009","","2007/05/09","X0725","",-1025,0,-1025 > send> "7009CR","","2007/05/09","X0725","",1025,0,1025 > send> "709","","2007/05/09","X0725","",-1025,0,-1025 > send> "767","01-0001","2007/06/18","X0731","",-500,0,-500 > send> "768","01-0001","2007/06/18","X0731","",-112.37,0,-112.37 > send> "769","01-0001","2007/06/18","X0731","",-112.37,0,-112.37 > send> "771VT","01-0001","2007/06/20","X0731","",-545,0,-545 > send> "772UT","01-0001","2007/06/20","X0731","",-500,0,-500 > send> "773NTCODE","01-0001","2007/06/20","X0731","",-600,0,-600 > send> "774VTUTUT","01-0001","2007/06/20","X0731","",-309,0,-309 > send> "775NTUT","01-0001","2007/06/20","X0731","",-200,0,-200 > send> "8001","01-0001","2007/05/23","X0727","",-1000,0,-1000 > send> "8002","01-0001","2007/05/23","X0727","",-1000,0,-1000 > send> "88","0000132","2008/07/10","X0834","",-225,0,-225 > send> "89","0000132","2008/07/10","X0834","",-2145,0,-2145 > send> "90","0000132","2008/07/10","X0834","",-800,0,-800 > send> "91","0000132","2008/07/10","X0834","",-16.07,0,-16.07 > send> "93","0000132","2008/07/10","X0834","",-4980.8,0,-4980.8 > send> "94","0000132","2008/07/10","X0834","",-225,0,-225 > send> "96","0000132","2008/07/10","X0834","",-225,0,-225 > send> "97","0000132","2008/07/10","X0834","",-24,0,-24 > send> "REGION 1-02","01-0001","2007/05/03","X0724","",-1550,0,-1550 > send> "5561","","2008/07/03","T0838","",-554,554,0 > send> "5004MC","01-0001","2007/05/16","0733","",-1000,0,-1000 > send> "760","01-0001","2007/05/23","0733","",-1000,0,-1000 > send> "CSP1001","01-0001","2007/05/11","0733","",-1000,0,-1000 > send> "TEST","01-0001","2007/05/01","0733","",-1000,0,-1000 > send> "TEST1","01-0001","2007/05/01","0733","",-1000,0,-1000 > send> "TEST2","01-0001","2007/07/01","0742","",-1000,0,-1000 > send> "656","","2008/08/27","T0842","",-211,211,0 > send> "982","","2008/06/19","0838","",-800,800,0 > send> "554","","2008/08/27","0846","",-2000,2000,0 > send> "810","","2008/11/19","0907","",-5000,5000,0 > send> "34-222-1","New Stuff","2008/02/28","F0811","",-78999,0,-78999 > send> "51","","2008/06/01","F0825","",-2000,2000,0 > send> "52","","2008/06/01","F0825","",-1200,1200,0 > send> "67-8989","Insurance","2008/03/28","F0815","",-890000,0,-890000 > send> "73","","2008/07/15","X0835","",-554,554,0 > send> "922","","2008/07/07","0842","",-250,250,0 > recv> HTTP/1.1 400 Bad Request > recv> Set-Cookie: > WRITELY_SID=DQAAAHsAAADW2Av0QZeG5bHJkM5828eMtdRLywuq28dItoSrPP9TwLksnEhcwk6vAwosZVudULwQ3S9I5sEE9PfiPh4Ig4rR30zq3n92TviKjHz4igmkkVLs1ofy-6S1L9QSA6lmTZTJ9GuL9zGIfjuPjcidlOca87KvfC- > vfvPWtJj3RA_6gA;Domain=docs.google.com;Path=/;Expires=Sat, 13-Dec-2008 > 08:54:50 GMT > recv> Content-Type: text/html; charset=UTF-8 > recv> Transfer-Encoding: chunked > recv> Date: Fri, 28 Nov 2008 08:54:51 GMT > recv> X-Content-Type-Options: nosniff > recv> Expires: Fri, 28 Nov 2008 08:54:51 GMT > recv> Cache-Control: private, max-age=0 > recv> Server: GFE/1.3 > recv> Connection: Close > recv> > recv> 1b > recv> Could not convert document. > recv> 0 > recv> > > >>>>> Channel CLOSED > > I have tested some variations of the above message, adding "Content- > Transfer-Encoding: binary" header, "Slug: whatever.csv" header, > stripping double quotes around text fields, all to no avail... > > If I extract the actual document content from this debug output, save > it to a CSV file, and upload it from the Google Docs UI, it works, my > spreadsheet is appropriately loaded with the data. > > What am I missing ? > > TIA for any answer, > Stéphane --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
