Tema: Google docs
Ver Mensaje Individual
  #3  
Antiguo 08-06-2010
Avatar de erickahr
erickahr erickahr is offline
Miembro
 
Registrado: feb 2010
Posts: 94
Reputación: 15
erickahr Va por buen camino
Red face Hola

Sigo con el problema, he encontrado en al API la siguiente info:
Cita:
Creating an empty document

Here is an example of creating a document by uploading metadata to the server with an HTTP POST request. This will create an empty document called new document on Google Documents.
POST /feeds/default/private/full HTTP/1.1Host: docs.google.comGData-Version: 3.0Content-Length: 287Content-Type: application/atom+xml<?xml version='1.0' encoding='UTF-8'?><entry xmlns="http://www.w3.org/2005/Atom"> <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/docs/2007#document"/> <title>new document</title></entry>
he puesto este codigo en mi aplicacion pero me da un error de autenticacion, aunque el asunto del acceso esta resuelto ya que si puedo añadir informacion a una hoja previamente creada.

Código Delphi [-]
procedure TfrMain.btnCrearClick(Sender: TObject);
var
  res, StrData, FromAttr: String;
  postStream: TStream;
  resStream: TStringStream;
begin
  fromAttr:='http://docs.google.com';

 StrData:='+QuotedStr('1.0')+' encoding=' +QuotedStr('UTF-8')+ '?> '+
           ' '  +
             '+
                'term="http://schemas.google.com/docs/2007#document"/> ' +
             'new document '  +
           '  ';

  try
    Altas.Request.CustomHeaders.Values ['Authorization'] := 'GoogleLogin auth=' + googleAuth.AuthString;
    Altas.Request.CustomHeaders.Values ['Content-type'] := 'application/atom+xml';
    Altas.Request.CustomHeaders.Values ['GData-Version'] := '2.0';

    Altas.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(Altas);
    postStream := TStringStream.Create (strData);
    showmessage(StrData);

    postStream.Position := 0;
    res := Altas.Post (fromAttr, postStream);
    showmessage(res);
  Except
    on e: Exception do
      Showmessage(e.ClassName+': '+e.Message);
  end;
end;

Vuelvo a poner esta parte porque en la parte de arriba no me lo respeta, no se porque, en edicion se ve completo pero ya guardado aparece incompleto.

StrData:='<?xml version='+QuotedStr('1.0')+' encoding=' +QuotedStr('UTF-8')+ '?> '+
'<entry xmlns="http://www.w3.org/2005/Atom"> ' +
'<category scheme="http://schemas.google.com/g/2005#kind" '+
'term="http://schemas.google.com/docs/2007#document"/> ' +
'<title>new document</title> ' +
'</entry> ';

Sigo esperando que alguien me pueda ayudar, Saludos y gracias de antemano.
__________________
Nadie puede separar su fe de sus actos, o sus creencias de sus afanes

Última edición por erickahr fecha: 08-06-2010 a las 01:25:54. Razón: falto codigo por postear
Responder Con Cita