I'd be surprised if the name 'cellar-id' was legal. Try 'cellarid'. To be sure of it, do a GET with the list feed to see what the header values actually are. Google's documentation on the List feed's name-munging of column names is woeful, but I've gotten reasonable results by stripping out anything that isn't [a-zA-Z0-9].
In fact, if you've just freshly created your sheet it doesn't actually have column headers in row 1, then I'd be surprised if this call worked at all. You'll first have to use the cells feed to populate row 1 with the column headers and *then* the list feed will have column names. Good luck, David. On Wed, Jun 22, 2011 at 7:30 AM, Scott Malinowski <[email protected]>wrote: > Ugh. I'm pulling my hair out on this one. I am using JavaScript and Ajax to > work with Google Spreadsheets. I am able to create a spreadsheet and a > worksheet but I get an error when I try to add a row. The error I get is > "We're sorry, a server error occurred. Please wait a bit and try > reloading your spreadsheet." I've searched the forum for this but the only > answers I have found were not successful for me. > > I retrieved the POST URL from the Lists feed and am using it in the > following request to add a row: > > var ajaxRequest = new Ajax.Request( > https://spreadsheets.google.com/feeds/list/*key*/*worksheetId* > /private/full, > { > method: "POST", > contentType: "application/atom+xml", > postBody: "<entry xmlns=\"http://www.w3.org/2005/Atom\" > xmlns:gsx=\"http://schemas.google.com/spreadsheets/2006/extended\"><gsx:cellar-id>1</gsx:cellar-id><gsx:name>My > Cellar</gsx:name></entry>", > requestHeaders: [ "GData-Version", GoogleVersion, "Authorization", > GoogleSpreadsheetsAuthKey ], > onSuccess: this.addRow.bind(this, success), > onFailure: this.ajaxFailure.bind(this) > } > ); > > GoogleVersion is a global variable and is set to "3.0". > GoogleSpreadsheetsAuthKey also is a global variable and I am setting it when > I log the user in to Google; I know the value for GoogleSpreadsheetsAuthKey > is valid because I am successfully creating the spreadsheet and worksheet > right before I try to add the row. > > Any ideas? I have been racking my brain and trying many things for hours. I > am at my wits end. > > Thank you, > Scott >
