I just figured it out... I knew it was something dumb! I copied the URL from the Developer's Guide:
/feeds/acl/private/full/document%3Adocument_id/batch HTTP/1.1 and included the " HTTP/1.1" in the URL not realizing that's just meaning use HTTP 1.1... haha it's working now! thanks Daniel On Apr 1, 3:02 pm, Daniel Marashlian <[email protected]> wrote: > Hi Eric, > > I just tried to copy the code from the Developer's guide, and I'm > getting the same error message (The remote server returned an error: > (400) Bad Request). One thing that might be worth mentioning, While > testing, I'm using ClientLogin for authentication. So maybe it's > broken on ClientLogin Auth? I'm not sure... > > This is the same technique that I used for our other functions that we > have to add a single collaborator, and it works... but if i change the > XML and the HttpWebRequest URL it doesn't work :( > > what am I doing wrong!!!! Thank you in advance for all the help!!! > > here is the code I'm using to make the POST (it's in C#). > > //role is "writer" > //type is "document" > public static string BatchSetUserRole(string docID, string role, > string type) > { > //auth is the clientLogin key from google > string auth = Authenticate(); > > //Create a web request for the Google ClientLogin service > HttpWebRequest authRequest = (HttpWebRequest)HttpWebRequest.Create > (String.Format("http://docs.google.com/feeds/acl/private/full/{0}%3A > {1}/batch HTTP/1.1", type, docID)); > authRequest.KeepAlive = false; > authRequest.ContentType = "application/atom+xml"; > authRequest.Method = "POST"; > authRequest.Headers.Add("Authorization: GoogleLogin auth=" + auth); > > //Build the POST data - this returns the XML from the Developer's > guide > string postBuilder = BatchXmlSetUser(role, docID); > > //Convert the POST data to a byte[] > byte[] data = ASCIIEncoding.ASCII.GetBytes(postBuilder.ToString()); > authRequest.ContentLength = data.Length; > > //Get the request stream and POST the data > Stream requestStream = authRequest.GetRequestStream(); > requestStream.Write(data, 0, data.Length); > requestStream.Close(); > > //Get the response > HttpWebResponse authResponse = (HttpWebResponse) > authRequest.GetResponse(); > Stream responseStream = authResponse.GetResponseStream(); > StreamReader responseReader = new StreamReader(responseStream); > > string response = responseReader.ReadToEnd(); > > //close streams > responseReader.Close(); > responseStream.Close(); > authResponse.Close(); > > return response; > > } > > //this is the function to build the XML code which was copied from the > Developer's guide. > private static string BatchXmlSetUser(string role, string docID) > { > string EntityTemplate = @"<feed xmlns='http://www.w3.org/2005/Atom' > xmlns:gAcl='http://schemas.google.com/acl/2007'xmlns:batch='http:// > schemas.google.com/gdata/batch'> > <category scheme='http://schemas.google.com/g/2005#kind' > term='http://schemas.google.com/acl/2007#accessRule'/> > <entry> > > <id>http://docs.google.com/feeds/acl/private/full/document%3A" + > docID + @"/user%3Adanielzev%40gmail.com</id> > <batch:operation type='query'/> > </entry> > <entry> > <batch:id>1</batch:id> > <batch:operation type='insert'/> > <gAcl:role value='writer'/> > <gAcl:scope type='user' > value='[email protected]'/> > </entry> > <entry> > > <id>http://docs.google.com/feeds/acl/private/full/document%3A" + > docID + @"/user%3Adaniel%40pelotonics.com</id> > <batch:operation type='update'/> > <gAcl:role value='reader'/> > <gAcl:scope type='user' > value='[email protected]'/> > </entry> > <entry> > > <id>http://docs.google.com/feeds/acl/private/full/document%3A" + > docID + @"/user%3Adanielzev%40yahoo.com</id> > <batch:operation type='delete'/> > </entry> > </feed>"; > > return EntityTemplate; > > } > > On Mar 31, 1:21 pm, "Eric (Google)" <[email protected]> wrote: > > > Hi Daniel, > > > Your XML looks good to me. I was able to cut/paste > > the XML in the Developer's guide and POST > > it > > successfully.http://code.google.com/apis/documents/docs/2.0/developers_guide_proto... > > > Have you tried other types of documents? > > > Eric > > > On Mar 30, 1:47 pm, Daniel Marashlian <[email protected]> wrote: > > > > hi Eric, > > > > do you have any idea what I'm doing wrong here? > > > > thanks, > > > Daniel > > > > On Mar 26, 10:16 pm, Daniel Marashlian <[email protected]> wrote: > > > > > here is the XML string I'm passing in: > > > > > "<feed xmlns='http://www.w3.org/2005/Atom'xmlns:gAcl='http:// > > > > schemas.google.com/acl/2007' xmlns:batch='http://schemas.google.com/ > > > > gdata/batch'> > > > > <category scheme='http://schemas.google.com/g/ > > > > 2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/ > > > > > <entry> > > > > <batch:id>1</batch:id> > > > > <batch:operation type='insert'/ > > > > > <gAcl:role value='writer'/> > > > > <gAcl:scope type='user' > > > > value='[email protected]'/> > > > > </entry> > > > > <entry> > > > > <batch:id>2</batch:id> > > > > <batch:operation type='insert'/ > > > > > <gAcl:role value='writer'/> > > > > <gAcl:scope type='user' > > > > value='[email protected]'/> > > > > </entry> > > > > </feed>" > > > > > this is what I'm POSTING to (where df2qg349_2042dw8s8cg is the ID of > > > > my test > > > > document):http://docs.google.com/feeds/acl/private/full/document%3Adf2qg349_204... > > > > HTTP/1.1 > > > > > though the code is giving me a, "The remote server returned an error: > > > > (400) Bad Request." error. > > > > > Any ideas? > > > > > thanks! > > > > Daniel > > > > > On Mar 25, 3:10 pm, Daniel Marashlian <[email protected]> wrote: > > > > > > thanks Eric!!!! > > > > > > I'm gonna start the testing right now :) > > > > > > On Mar 25, 2:46 pm, "Eric (Google)" <[email protected]> wrote: > > > > > > > Batching ACL > > > > > > requests:http://code.google.com/apis/documents/docs/2.0/developers_guide_proto... > > > > > > > On Mar 25, 9:59 am, Daniel Marashlian <[email protected]> wrote: > > > > > > > > Hi Eric and GDocs users, > > > > > > > > I'm going to start a new discussion here since my last post wasn't > > > > > > > really relevant to it's topic. > > > > > > > > Would someone mind constructing an example for Batch Processing to > > > > > > > modify the ACL of a document? > > > > > > > > I can't figure it out following this > > > > > > > doucment:http://code.google.com/apis/gdata/batch.html > > > > > > > > thanks! > > > > > > > Daniel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
