Hi,
Could you, please, tell me how to compose the Soap message for uploading/downloading a file to Zimbra?
I have seen something about FileUploadServlet, but I don't know how to use it..
Help me, please.. :rolleyes:
Thank you,
Cris.
upload file via Soap
upload file via Soap
I need it too, please help. How to use the FileUploadServlet. An example would be perfect.
upload file via Soap
Please look at ZimbraServer/docs/file-upload.txt in the source distribution and let us know if that's not good enough.
You can also do a GET or PUT to the REST interface to fetch or add a file.
You can also do a GET or PUT to the REST interface to fetch or add a file.
upload file via Soap
OK. Thank you for your response. After a few tests we got an example running, but another problem appeared : the response doesn't seem to be correct. Here it is :
And the SAVE_DOCUMENT_REQUEST replies Cannot create (SoapFaultException).
And the SAVE_DOCUMENT_REQUEST replies Cannot create (SoapFaultException).
upload file via Soap
We managed to do the upload part.
Any suggestions from where to start in order to download ?
Any suggestions from where to start in order to download ?
Re: upload file via Soap
dkarp wrote:Please look at ZimbraServer/docs/file-upload.txt in the source distribution and let us know if that's not good enough.
Yes, please, an example of how to get the AID would be very very helpful !
The "file-upload.txt" doesn't mention the ID of the uploaded file being returned.
And the SOAP API requires this ID to send a message with attachment.
Thanks
Re: upload file via Soap
Can you kindly provide the body of the request you made to the Zimbra SOAP API for uploading the file? An example would be quite helpful.BallaK wrote:We managed to do the upload part.
Any suggestions from where to start in order to download ?
Re: upload file via Soap
Uploading files to Zimbra is basically a 2-step process. You need to upload the actual file content and then send a request to save the document.
To upload the file, you actually call the FileUploadServlet. This is not a SOAP request, just a POST to the appropriate URL with the content. You will need to specify a couple of things with the request.
ZM_AUTH_TOKEN - in the cookie HTTP header on the request.
CONTENT_TYPE - CONTENT_TYPE HTTP header
CONTENT_DISPOSITION - CONTENT_DISPOSITION HTTP header with "attachment: filename="myfile.txt"" fo the value.
This will return a plain text string with the ID of the uploaded content. For example:
To actually save the document, you will use the SaveDocumentRequest (see https://files.zimbra.com/docs/soap_api/ ... ument.html).
The important fields below are:
name - the name of the file
ct - the file content type
l - the id of the parent folder
upload:id - the id from the previous step
The content type and file name may seem redundant in both places, and in fact I believe they are. It is probably only needed in the SOAP call, but I do it both places anyway.
Some additional documentation is available in the server docs:
https://github.com/Zimbra/zm-mailbox/bl ... upload.txt
https://github.com/Zimbra/zm-mailbox/bl ... cument.txt
You will also find the information there on downloading documents.
Hope this helps.
To upload the file, you actually call the FileUploadServlet. This is not a SOAP request, just a POST to the appropriate URL with the content. You will need to specify a couple of things with the request.
ZM_AUTH_TOKEN - in the cookie HTTP header on the request.
CONTENT_TYPE - CONTENT_TYPE HTTP header
CONTENT_DISPOSITION - CONTENT_DISPOSITION HTTP header with "attachment: filename="myfile.txt"" fo the value.
This will return a plain text string with the ID of the uploaded content. For example:
Code: Select all
18baa043-394f-42ae-be8a-110b279cb696:cc2f2fdf-7957-4412-aa83-6433662ce5d0
The important fields below are:
name - the name of the file
ct - the file content type
l - the id of the parent folder
upload:id - the id from the previous step
Code: Select all
{
"Header": {
"context": {
"userAgent": {
"version": "1.0",
"name": "my_uploader"
},
"account": {
"_content": "your_name@example.com",
"by": "name"
},
"authToken": "XXXX",
"_jsns": "urn:zimbra"
}
},
"Body": {
"SaveDocumentRequest": {
"_jsns": "urn:zimbraMail",
"doc": {
"name": "myfile.txt",
"ct": "text/plain",
"l": 1021,
"upload": {
"id": "18baa043-394f-42ae-be8a-110b279cb696:cc2f2fdf-7957-4412-aa83-6433662ce5d0"
}
}
}
}
}
Some additional documentation is available in the server docs:
https://github.com/Zimbra/zm-mailbox/bl ... upload.txt
https://github.com/Zimbra/zm-mailbox/bl ... cument.txt
You will also find the information there on downloading documents.
Hope this helps.
John Eastman