Remote API Implementation > Writer > ZW - Using normal form submit

ZW - Using normal form submit

Tags:  

Using normal form submit


User can make use of normal form submit in case their document is residing over a web url. To push the document from the remote server, submit a form to Zoho Writer with the following form fields.

Field Description
url url from which zoho writer can fetch the document.

Note
: it is mandatory to specify the absolute path of the document in url parameter with proper file extension.
filename filename of the document with extension (examples: .doc, .docx, .html, .sxw, .odt, .rtf, .txt )
id unique id that will be submitted while saving the document (reference)
format the format in which document should be saved on remote server (examples: .doc, .docx, .html, .pdf, .sxw, .odt, .rtf, .txt )
persistence(deprecated) persistence = true has been deprecated now and the default value of this parameter is set to false. The document pushed to Zoho Servers will be editable only once. The data will automatically be deleted from Zoho Servers when the user closes the browser's session
saveurl
[REMOTE SERVER SAVE URL] - The Web URL should be a service that fetches the content of the updated document and saves it to the user specified location.

Note : The saveurl specified should be a proper domain name with its port set to 80. Specifying IP Address as saveurl value is not encouraged. Example - http://xyz.com/docs/save.php



Sample form


<form method="POST" action="http://export.writer.zoho.com/remotedoc.im?apikey=[apikey]&
output=editor" target="_self" accept-charset="UTF-8">

<input type="hidden" name="url" value="[http://abc.com/documents/test.doc]">

<input type="hidden" name="saveurl" value="[http://xyz.com/docs/save.php]">

<input type="hidden" name="filename" value="mydocument.doc">

<input type="hidden" name="id" value="12345678">

<input type="hidden" name="format" value="pdf">

<input type="hidden" name="persistence" value="false">

<input type="submit" value="Edit" class="divbutton" name="submit">

</form>


Note : In order to edit a document in Zoho Writer, it must be submitted as a normal form data either from the client side or it can be done as an emulated form submission on the server side of the remote server.

API URLNew!

To access a normal form based remote API, the users should post to the following URL format mentioned below :

http://export.writer.zoho.com/remotedoc.im?apikey=<apikey>&output=view/viewurl/editor/url/id

The output parameter decides the format in which output will be sent. Currently Zoho Writer allows five different values that can be passed in the output parameter. They are -
  • view - By passing 'view' as the output value, the response will be javascript code snippet which automatically loads the document in Writer's remote editor in view-only mode.

  • url - By passing 'url' as the output value, users will get a response of the document in form of a url clicking on which will automatically load the document in Writer's remote editor for editing.

  • editor - By passing 'editor' as the output value the response will be javascript code snippet which automatically loads Zoho Writer editor with the document content opened for editing.

  • viewurl - By passing 'viewurl' as the output value, users will get a response of the document in form of a url clicking on which will automatically load the document in Writer's editor for viewing purpose only.

  • id - By passing 'id' as the output value, users will get a response of the document in form of a document id which they can use as part of iFrame tag to open the document from within their blog or website.
Note : By default the response will be a URL. So in case you wish to open the document in new window using writer editor mention value as "editor" in output parameter.


Sample Response Format for URL request

Users who wish to embed the writer editor in an iframe instead of opening it in a new window can do so by passing the output parameter as 'url' :

http://export.writer.zoho.com/remotedoc.im?apikey=[apikey]&output=url

The response will be a url which contains the encrypted id for the document. This url obtained can be added to the "src" attribute of the iframe for embedding.

URL=http://export.writer.zoho.com/editor.im?doc=C77076EG003waI770c1
WARNING=
RESULT=TRUE


Sample Code

Once you are done with editing your document and press save, Zoho Writer converts the document to the required format(doc/pdf/sxw...etc.,) specified in the above form and sends the modified content to the saveurl. We have come up with some sample codes in different languages that simulates as to how a save file should look like.





 RSS of this page