[Google-Docs-Data-APIs] Documents List Data API

2009-04-01 Thread masa...@i3

Hi

I have tried 2-legged OAuth access using Documents List Data API,
but got error.
 -401 Unknown authorization header-
If I use Calendar API, it's all right.

Can we use 2-legged OAuth using Documents List Data API?
If is it yes, what is the point we have to do?

The request header is there below.
===
Authorization=
  OAuth oauth_consumer_key=xx
  oauth_nonce=xx
  oauth_signature=xxx
  oauth_signature_method=HMAC-SHA1
  oauth_timestamp=1238552322
  oauth_version=1.0
  scope=http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F%20http%3A%2F
%2Fwww.google.com%2Fcalendar%2Ffeeds%20http%3A%2F%2Fdocs.google.com
%2Ffeeds%20http%3A%2F%2Fspreadsheets.google.com%2Ffeeds
  xoauth_requestor_id=xx

Content-Type=application/atom+xml
GData-Version=2.0
===


Thanks,
Masashi
--~--~-~--~~~---~--~~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Create python MediaSource without a file?

2009-04-01 Thread AN

In app engine - if I want to create a gdata.MediaSource - what are the
options? The MediaSource class wants a file_path but app. engine won't
allow that. I believe I'll have to get a blob from the database. The
Java API allows a byte[] as an input but can't find an equivalent in
the Python API.

Please advise..

Thanks!
--~--~-~--~~~---~--~~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Re: Create python MediaSource without a file?

2009-04-01 Thread Eric Bidelman
The unit tests have an example of using a stream:
http://code.google.com/p/gdata-python-client/source/browse/trunk/tests/gdata_tests/docs/service_test.py#327

Eric

On Wed, Apr 1, 2009 at 9:34 AM, AN data2w...@gmail.com wrote:


 In app engine - if I want to create a gdata.MediaSource - what are the
 options? The MediaSource class wants a file_path but app. engine won't
 allow that. I believe I'll have to get a blob from the database. The
 Java API allows a byte[] as an input but can't find an equivalent in
 the Python API.

 Please advise..

 Thanks!
 


--~--~-~--~~~---~--~~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Re: Documents List Data API

2009-04-01 Thread Eric Bidelman
Can you post relevant code?

On Wed, Apr 1, 2009 at 3:00 AM, masa...@i3 masa...@i3-systems.com wrote:


 Hi

 I have tried 2-legged OAuth access using Documents List Data API,
 but got error.
  -401 Unknown authorization header-
 If I use Calendar API, it's all right.

 Can we use 2-legged OAuth using Documents List Data API?
 If is it yes, what is the point we have to do?

 The request header is there below.
 ===
 Authorization=
  OAuth oauth_consumer_key=xx
  oauth_nonce=xx
  oauth_signature=xxx
  oauth_signature_method=HMAC-SHA1
  oauth_timestamp=1238552322
  oauth_version=1.0
  scope=http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F%20http%3A%2F
 %2Fwww.google.com%2Fcalendar%2Ffeeds%20http%3A%2F%2Fdocs.google.com
 %2Ffeeds%20http%3A%2F%2Fspreadsheets.google.com%2Ffeeds
  xoauth_requestor_id=xx

 Content-Type=application/atom+xml
 GData-Version=2.0
 ===


 Thanks,
 Masashi
 


--~--~-~--~~~---~--~~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Re: DocList API Release 2009-03

2009-04-01 Thread Franck

Ok I will be more detailed:
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentList.java#109
[...]
  private static final MapString, String
DOWNLOAD_PRESENTATION_FORMATS;
  static {
DOWNLOAD_PRESENTATION_FORMATS = new HashMapString, String();
DOWNLOAD_PRESENTATION_FORMATS.put(pdf, pdf);
DOWNLOAD_PRESENTATION_FORMATS.put(ppt, ppt);
DOWNLOAD_PRESENTATION_FORMATS.put(swf, swf);
  }
[...]
But since http://code.google.com/apis/documents/changelog.html#release-2009-03
It would be :
[...]
  private static final MapString, String
DOWNLOAD_PRESENTATION_FORMATS;
  static {
DOWNLOAD_PRESENTATION_FORMATS = new HashMapString, String();
DOWNLOAD_PRESENTATION_FORMATS.put(pdf, pdf);
DOWNLOAD_PRESENTATION_FORMATS.put(ppt, ppt);
DOWNLOAD_PRESENTATION_FORMATS.put(swf, swf);
// New png export format since 
http://code.google.com/apis/documents/changelog.html#release-2009-03
DOWNLOAD_PRESENTATION_FORMATS.put(png, png);
  }
[...]

I have tested it on my little project (a Swing Gui listing Google docs
with a download option with all export format).
So here is my question about updating
http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentList.java
with this new export format.

I hope I'm clearer this time ;-)


On Apr 1, 7:53 pm, Eric Bidelman api.e...@google.com wrote:
 I'm guess I don't know what you're asking.  The Java sample has alreadybeen
 updated with the new features (export/download, folders, acls, etc.).
 The library itself didn't change.

 Eric



 On Tue, Mar 31, 2009 at 11:39 PM, Franck franck.arnu...@gmail.com wrote:

  I'm sorry, but I didn't get it ?

  On Apr 1, 12:17 am, Eric Bidelman api.e...@google.com wrote:
   Already updated :)

   On Tue, Mar 31, 2009 at 3:13 PM, Franck franck.arnu...@gmail.com
  wrote:

Do you plan to update the java DocumentList

   http://code.google.com/p/gdata-java-client/source/browse/trunk/java/s.
  ..
?

Thanks

On Mar 28, 12:48 am, Eric Bidelman api.e...@google.com wrote:
 These are API changes and not .NET lib changes so you should be fine
 with 1.4.0.2.
 Regards,
 Eric

 On Fri, Mar 27, 2009 at 3:27 PM, Daniel Marashlian 
  daniel...@gmail.com
wrote:

  Do we need to get new .DLL files? or will version 1.4.0.2 work?

  On Mar 27, 2:45 pm, Eric (Google) api.e...@google.com wrote:

 http://code.google.com/apis/documents/changelog.html#release-2009-03
--~--~-~--~~~---~--~~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Re: DocList API Release 2009-03

2009-04-01 Thread Eric Bidelman
Thanks for clarifying.
Can you open an issue with that request (and anything else you see missing):
http://code.google.com/p/gdata-java-client/issues/list

On Wed, Apr 1, 2009 at 11:57 AM, Franck franck.arnu...@gmail.com wrote:


 Ok I will be more detailed:

 http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentList.java#109
 [...]
  private static final MapString, String
 DOWNLOAD_PRESENTATION_FORMATS;
  static {
DOWNLOAD_PRESENTATION_FORMATS = new HashMapString, String();
DOWNLOAD_PRESENTATION_FORMATS.put(pdf, pdf);
DOWNLOAD_PRESENTATION_FORMATS.put(ppt, ppt);
DOWNLOAD_PRESENTATION_FORMATS.put(swf, swf);
  }
 [...]
 But since
 http://code.google.com/apis/documents/changelog.html#release-2009-03
 It would be :
 [...]
  private static final MapString, String
 DOWNLOAD_PRESENTATION_FORMATS;
  static {
DOWNLOAD_PRESENTATION_FORMATS = new HashMapString, String();
DOWNLOAD_PRESENTATION_FORMATS.put(pdf, pdf);
DOWNLOAD_PRESENTATION_FORMATS.put(ppt, ppt);
DOWNLOAD_PRESENTATION_FORMATS.put(swf, swf);
// New png export format since
 http://code.google.com/apis/documents/changelog.html#release-2009-03
DOWNLOAD_PRESENTATION_FORMATS.put(png, png);
  }
 [...]

 I have tested it on my little project (a Swing Gui listing Google docs
 with a download option with all export format).
 So here is my question about updating

 http://code.google.com/p/gdata-java-client/source/browse/trunk/java/sample/docs/DocumentList.java
 with this new export format.

 I hope I'm clearer this time ;-)


 On Apr 1, 7:53 pm, Eric Bidelman api.e...@google.com wrote:
  I'm guess I don't know what you're asking.  The Java sample has
 alreadybeen
  updated with the new features (export/download, folders, acls, etc.).
  The library itself didn't change.
 
  Eric
 
 
 
  On Tue, Mar 31, 2009 at 11:39 PM, Franck franck.arnu...@gmail.com
 wrote:
 
   I'm sorry, but I didn't get it ?
 
   On Apr 1, 12:17 am, Eric Bidelman api.e...@google.com wrote:
Already updated :)
 
On Tue, Mar 31, 2009 at 3:13 PM, Franck franck.arnu...@gmail.com
   wrote:
 
 Do you plan to update the java DocumentList
 

 http://code.google.com/p/gdata-java-client/source/browse/trunk/java/s.
   ..
 ?
 
 Thanks
 
 On Mar 28, 12:48 am, Eric Bidelman api.e...@google.com wrote:
  These are API changes and not .NET lib changes so you should be
 fine
  with 1.4.0.2.
  Regards,
  Eric
 
  On Fri, Mar 27, 2009 at 3:27 PM, Daniel Marashlian 
   daniel...@gmail.com
 wrote:
 
   Do we need to get new .DLL files? or will version 1.4.0.2 work?
 
   On Mar 27, 2:45 pm, Eric (Google) api.e...@google.com
 wrote:
 
  http://code.google.com/apis/documents/changelog.html#release-2009-03
 


--~--~-~--~~~---~--~~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Re: Create Copy of spread sheets and forms through ruby on rails

2009-04-01 Thread tomas

I saw the link and the documentation but I can't figure out how I
finish the feature that I say above.
Someone know?

Thanks,
Tomás

On Mar 27, 8:39 pm, tomas tomasdest...@gmail.com wrote:
 I saw the link but I have two questions:
 - Where I put the content in the upload file?
 - The send_email method ... should I use the Gmail API for atach a file
 (the form I upload above)?

 On Mar 26, 6:48 pm, Eric Bidelman api.e...@google.com wrote:

  Try taking out '?xml version='1.0' encoding='UTF-8'?'
  Seehttp://code.google.com/apis/documents/articles/gdata_on_rails.html#Ac...

  Eric

  On Thu, Mar 26, 2009 at 2:04 PM, tomas tomasdest...@gmail.com wrote:

   I understand your observations.
   Thank you.
   But I'm trying to download and upload the file and I refactor my code
   and I'm receiving the error when I try to upload a file

   The error is GData::Client::BadRequestError Exception: The processing
   instruction target matching quot;[xX][mM][lL]quot; is not allowed.
   My question is: I'm in the right direction??
   This is the code:

   def find_document_name
       @session_type = @session.session_type

       begin
       �...@document_name = @client.get(DOCLIST_FEED + /-/spreadsheet?
   title...@session_type.format_document_name}titleexact=true).to_xml
     rescue Exception = e
      flash[:error] = O Documento não foi enviado. Verifique o nome
   atrelado ao tipo do evento.
    end

   �...@document_name.elements.each(entry) do |entry|
          id = entry.elements['id'].text[/%3[aA](.*)$/, 1]
          document = download_document(id)
         upload_document(document)
         send_email
     end
     redirect_to session_registrations_url
   end

   def download_document(id)
      document = @client.get(SPREADSHEETS_SCOPE + download/spreadsheets/
   Export?key=#{id}fmcmd=4).body
   end

   def upload_document(document, body)
    entry = -EOF
    ?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:titleUploaded File example/atom:title
   /atom:entry
    EOF
    begin
   # Here is the error
       feed = @client.post(DOCLIST_FEED, entry)
    rescue Exception = e
      flash[:error] = 
    end
   end

   Thanks,
   Tomás

   On Mar 24, 2:41 am, Eric Bidelman api.e...@google.com wrote:
What exactly is the error you're receiving?
A couple of observations:
- your download_document() always tries to
download spreadsheets, but find_document()
may match (and return) other types of documents.
I would use this in find_document():
@client.get(DOCLIST_FEED
+
   /-/spreadsheet?title...@session_type.format_document_name}titleexact=true­).to_xml

- You probably want to append .body to your get() call in
download_document():
@client.get(...).body

- upload_document() doesn't do anything with its document argument.
  To upload a document, you need to use @client.post().  The url is
  'http://docs.google.com/feeds/documents/private/full'

Hope that helps,
Eric

On Mon, Mar 23, 2009 at 10:28 PM, tomas tomasdest...@gmail.com wrote:

 I have tried download the document(form or spread sheet) via code and
 upload it back to the server and send email with the same form, using
 ruby on rails and gdata, and I have tried many methods and I have not
 been able to get it to work( downloading and uploading and send email
 with the form ).
 I read the API and here is the result:

 class RegistrationsController  ApplicationController

 ..
  # First I have to find the document for create a copy and send email
  def find_document
   # Session Type is a type of a Event
   @session_type = @session.session_type
   @document_name = @client.get(DOCLIST_FEED +
    ?title...@session_type.format_document_name}title-
 exact=true).to_xml

   �...@document_name.elements.each(entry) do |entry|
        id = entry.elements['id'].text[/full\/(.*)/, 1]

      # THIS IS THE PART I STOPPED
        document = download_document(id)
        upload_document(document)
        send_email
     end
     redirect_to session_registrations_url
  end

  def download_document(id)
    # I must download via code, because the user only wants send email
 with a copy of
    # a form that belongs to session type( type of a event)
    document = @client.get(SPREADSHEETS_SCOPE +
                 download/spreadsheets/Export?key=#{id}fmcmd=4)
   end

  def upload_document(document)
        feed = @client.get('
  http://docs.google.com/feeds/documents/private/
 full/-/mine').to_xml
  end

  def send_email
    # I have doubts to send email with the form that I upload above
  end

 ..
 end

 Thanks,
 Tomás
--~--~-~--~~~---~--~~
You 

[Google-Docs-Data-APIs] Re: Create Copy of spread sheets and forms through ruby on rails

2009-04-01 Thread Eric Bidelman
To upload documents with content, you need to either
create a mime multipart messages with an Atom XML entry
AND content, or just content:
http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html#UploadingWMetadata

I haven't tried this in the Ruby util library, but there seems to be a
post_file method that you could try:
http://code.google.com/p/gdata-ruby-util/source/browse/trunk/lib/gdata/client/base.rb?spec=svn14r=14#124

Eric

On Wed, Apr 1, 2009 at 1:29 PM, tomas tomasdest...@gmail.com wrote:


 I saw the link and the documentation but I can't figure out how I
 finish the feature that I say above.
 Someone know?

 Thanks,
 Tomás

 On Mar 27, 8:39 pm, tomas tomasdest...@gmail.com wrote:
  I saw the link but I have two questions:
  - Where I put the content in the upload file?
  - The send_email method ... should I use the Gmail API for atach a file
  (the form I upload above)?
 
  On Mar 26, 6:48 pm, Eric Bidelman api.e...@google.com wrote:
 
   Try taking out '?xml version='1.0' encoding='UTF-8'?'
   Seehttp://
 code.google.com/apis/documents/articles/gdata_on_rails.html#Ac...
 
   Eric
 
   On Thu, Mar 26, 2009 at 2:04 PM, tomas tomasdest...@gmail.com wrote:
 
I understand your observations.
Thank you.
But I'm trying to download and upload the file and I refactor my code
and I'm receiving the error when I try to upload a file
 
The error is GData::Client::BadRequestError Exception: The
 processing
instruction target matching quot;[xX][mM][lL]quot; is not allowed.
My question is: I'm in the right direction??
This is the code:
 
def find_document_name
@session_type = @session.session_type
 
begin
 @document_name = @client.get(DOCLIST_FEED + /-/spreadsheet?
title...@session_type.format_document_name}titleexact=true).to_xml
  rescue Exception = e
   flash[:error] = O Documento não foi enviado. Verifique o nome
atrelado ao tipo do evento.
 end
 
 @document_name.elements.each(entry) do |entry|
   id = entry.elements['id'].text[/%3[aA](.*)$/, 1]
   document = download_document(id)
  upload_document(document)
  send_email
  end
  redirect_to session_registrations_url
end
 
def download_document(id)
   document = @client.get(SPREADSHEETS_SCOPE +
 download/spreadsheets/
Export?key=#{id}fmcmd=4).body
end
 
def upload_document(document, body)
 entry = -EOF
 ?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:titleUploaded File example/atom:title
/atom:entry
 EOF
 begin
# Here is the error
feed = @client.post(DOCLIST_FEED, entry)
 rescue Exception = e
   flash[:error] = 
 end
end
 
Thanks,
Tomás
 
On Mar 24, 2:41 am, Eric Bidelman api.e...@google.com wrote:
 What exactly is the error you're receiving?
 A couple of observations:
 - your download_document() always tries to
 download spreadsheets, but find_document()
 may match (and return) other types of documents.
 I would use this in find_document():
 @client.get(DOCLIST_FEED
 +
   
 /-/spreadsheet?title...@session_type.format_document_name}titleexact=true­).to_xml
 
 - You probably want to append .body to your get() call in
 download_document():
 @client.get(...).body
 
 - upload_document() doesn't do anything with its document argument.
   To upload a document, you need to use @client.post().  The url is
   'http://docs.google.com/feeds/documents/private/full'
 
 Hope that helps,
 Eric
 
 On Mon, Mar 23, 2009 at 10:28 PM, tomas tomasdest...@gmail.com
 wrote:
 
  I have tried download the document(form or spread sheet) via code
 and
  upload it back to the server and send email with the same form,
 using
  ruby on rails and gdata, and I have tried many methods and I have
 not
  been able to get it to work( downloading and uploading and send
 email
  with the form ).
  I read the API and here is the result:
 
  class RegistrationsController  ApplicationController
 
  ..
   # First I have to find the document for create a copy and send
 email
   def find_document
# Session Type is a type of a Event
@session_type = @session.session_type
@document_name = @client.get(DOCLIST_FEED +
 ?title...@session_type.format_document_name}title-
  exact=true).to_xml
 
 @document_name.elements.each(entry) do |entry|
 id = entry.elements['id'].text[/full\/(.*)/, 1]
 
   # THIS IS THE PART I STOPPED
 document = download_document(id)
 upload_document(document)
 send_email
  end
  redirect_to session_registrations_url
   end
 
   def 

[Google-Docs-Data-APIs] Re: Batch Processing

2009-04-01 Thread Daniel Marashlian

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

idhttp://docs.google.com/feeds/acl/private/full/document%3A; +
docID + @/user%3Adanielzev%40gmail.com/id
batch:operation type='query'/
/entry
entry
batch:id1/batch:id
batch:operation type='insert'/
gAcl:role value='writer'/
gAcl:scope type='user' value='daniel...@hotmail.com'/
/entry
entry

idhttp://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='dan...@pelotonics.com'/
/entry
entry

idhttp://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) api.e...@google.com 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 daniel...@gmail.com wrote:

  hi Eric,

  do you have any idea what I'm doing wrong here?

  thanks,
  Daniel

  On Mar 26, 10:16 pm, Daniel Marashlian daniel...@gmail.com 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:id1/batch:id
                       batch:operation type='insert'/

                       gAcl:role value='writer'/
                       gAcl:scope type='user'
   value='dan...@pelotonics.com'/
                   

[Google-Docs-Data-APIs] Re: Batch Processing

2009-04-01 Thread Daniel Marashlian

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 daniel...@gmail.com 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
                         
 idhttp://docs.google.com/feeds/acl/private/full/document%3A; +
 docID + @/user%3Adanielzev%40gmail.com/id
                         batch:operation type='query'/
                 /entry
                 entry
                         batch:id1/batch:id
                         batch:operation type='insert'/
                         gAcl:role value='writer'/
                         gAcl:scope type='user' 
 value='daniel...@hotmail.com'/
                 /entry
                 entry
                         
 idhttp://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='dan...@pelotonics.com'/
                 /entry
                 entry
                         
 idhttp://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) api.e...@google.com 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 daniel...@gmail.com wrote:

   hi Eric,

   do you have any idea what I'm doing wrong here?

   thanks,
   Daniel

   On Mar 26, 10:16 pm, Daniel Marashlian daniel...@gmail.com 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' 

[Google-Docs-Data-APIs] Re: Batch Processing

2009-04-01 Thread Eric (Google)

By the way,  the correct links are always embedded
in the feed or entry.  In the case of batch ACLs,
the correct link is in the ACL feed of the document:

link rel=http://schemas.google.com/g/2005#batch;
 type=application/atom+xml
href=http://docs.google.com/feeds/acl/private/full/document
%3A12345abc/batch/

Eric

On Apr 1, 3:17 pm, Daniel Marashlian daniel...@gmail.com wrote:
 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 daniel...@gmail.com 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
                          
  idhttp://docs.google.com/feeds/acl/private/full/document%3A; +
  docID + @/user%3Adanielzev%40gmail.com/id
                          batch:operation type='query'/
                  /entry
                  entry
                          batch:id1/batch:id
                          batch:operation type='insert'/
                          gAcl:role value='writer'/
                          gAcl:scope type='user' 
  value='daniel...@hotmail.com'/
                  /entry
                  entry
                          
  idhttp://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='dan...@pelotonics.com'/
                  /entry
                  entry
                          
  idhttp://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) api.e...@google.com 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 
   

[Google-Docs-Data-APIs] Re: Remove all Collaborators

2009-04-01 Thread Eric Bidelman
That isn't supported directly, but building something similar is
relatively straightforward.

First, fetch the doc's acl feed.  Then construct a
batch acl feed by iterating over entry.
Your entry ids should correspond to
each link rel='edit'... from the fetched results.

POST /feeds/acl/private/full/document%3Adocument_id/batch
feed
entry
id
http://docs.google.com/feeds/acl/private/full/document%3Adocument_id/user%3Adeprecated_writer%40example.com
/id
batch:operation type='delete'/
 /entry
entry
id
http://docs.google.com/feeds/acl/private/full/document%3Adocument_id/user%3Adeprecated_reader%40example.com
/id
batch:operation type='delete'/
  /entry
...
/feed

Eric

On Wed, Apr 1, 2009 at 4:18 PM, Daniel Marashlian daniel...@gmail.comwrote:


 Does the API have the same functionality as the front end remove all
 link for the sharing section?

 watch this: http://screencast.com/t/2MwtXihS

 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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---



[Google-Docs-Data-APIs] Re: Remove all Collaborators

2009-04-01 Thread Daniel Marashlian

this is the reply I get back from your servers:

?xml version='1.0' encoding='UTF-8'?atom:feed xmlns:atom='http://
www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/
opensearchrss/1.0/' xmlns:gAcl='http://schemas.google.com/acl/2007'
xmlns:batch='http://schemas.google.com/gdata/batch'

atom:idhttp://docs.google.com/feeds/acl/private/full/document
%3Adf2qg349_2042dw8s8cg/atom:id
atom:updated2009-04-01T23:54:19.368Z/atom:updated
atom:title type='text'Batch Feed/atom:title
atom:link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml' href='http://docs.google.com/feeds/acl/
private/full/document%3Adf2qg349_2042dw8s8cg'/
atom:link rel='http://schemas.google.com/g/2005#post'
type='application/atom+xml' href='http://docs.google.com/feeds/acl/
private/full/document%3Adf2qg349_2042dw8s8cg'/
atom:link rel='http://schemas.google.com/g/2005#batch'
type='application/atom+xml' href='http://docs.google.com/feeds/acl/
private/full/document%3Adf2qg349_2042dw8s8cg/batch'/
atom:entry
atom:idhttp://docs.google.com/feeds/acl/private/full/document
%3Adf2qg349_2042dw8s8cg/fatal/atom:id
atom:updated2009-04-01T23:54:19.381Z/atom:updated
atom:title type='text'Fatal Error/atom:title
atom:content type='text'Feed processing was interrupted./
atom:content
batch:interrupted reason='[Line 6, Column 25, element entry]
Required extension element http://schemas.google.com/acl/2007:scope
not found.' parsed='0' success='0' error='0' unprocessed='0'/
/atom:entry

/atom:feed

On Apr 1, 4:53 pm, Daniel Marashlian daniel...@gmail.com wrote:
 yea, that's what I'm trying now... As you know I figured out the Batch
 Processing for inserting collaborators. So I'm trying to delete them
 now...

 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
 idhttp://docs.google.com/feeds/acl/private/full/document
 %3Adf2qg349_2042dw8s8cg/user%3Adaniel%40pelotonics.com/id
 batch:operation type='delete'/
 /entry
 /feed

 that's the XML I'm using. I'm using the same function to POST as I did
 for the ACL inserts for new collaborators, I'm just changing the XML
 now to delete the users.

 it's not working... hmmm...

 D

 On Apr 1, 4:39 pm, Eric Bidelman api.e...@google.com wrote:

  That isn't supported directly, but building something similar is
  relatively straightforward.

  First, fetch the doc's acl feed.  Then construct a
  batch acl feed by iterating over entry.
  Your entry ids should correspond to
  each link rel='edit'... from the fetched results.

  POST /feeds/acl/private/full/document%3Adocument_id/batch
  feed
  entry
      
  idhttp://docs.google.com/feeds/acl/private/full/document%3Adocument_id/...
  /id
      batch:operation type='delete'/
   /entry
  entry
      
  idhttp://docs.google.com/feeds/acl/private/full/document%3Adocument_id/...
  /id
      batch:operation type='delete'/
    /entry
  ...
  /feed

  Eric

  On Wed, Apr 1, 2009 at 4:18 PM, Daniel Marashlian 
  daniel...@gmail.comwrote:

   Does the API have the same functionality as the front end remove all
   link for the sharing section?

   watch this:http://screencast.com/t/2MwtXihS

   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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~--~~~~--~~--~--~---