Zoho Writer > Writer - REST API Methods > ZW - Share a document with a set of users

ZW - Share a document with a set of users

Tags:  



To share a document privately with a set of Zoho Writer users.



Request URL POST Method

                            XML : http://export.writer.zoho.com/api/private/xml/shareDocument/[documentID]?apikey=[API Key]&ticket=[Ticket]

                            JSON : http://export.writer.zoho.com/api/private/json/shareDocument/[documentID]?apikey=[API Key]&ticket=[Ticket]
 

Request parameters :

To share a document with a set of Zoho Writer users we need to submit a form data to Writer with the following fields:

Field
Description
documentId
Unique ID of the document that is to be shared.
shareto
[string] - One or more Zoho IDs/Email IDs of Zoho Writer users to whom the document is to be shared. For adding multiple users, separate them by 'comma'.
allowtowrite
[boolean] - Give access permission for editing the document to shared users. If true, then the users are allowed "Read/Write" access.


Sample Form (POST Method)


<form method="POST"    action="http://export.writer.zoho.com/api/private/xml/shareDocument/[documentId]?apikey=[APIKEY]&ticket=[Ticket]">

<input type="hidden" name="shareto" value="[Email IDs/Zoho IDs]">

<input type="hidden" name="allowtowrite" value="[true/false]">

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

</form>



* It is mandatory to pass the apikey and ticket parameters to access the shareDocuement api.

Response fields

The schema document for the API response is located at: http://export.writer.zoho.com/schema/restapi/share.xsd

Field
Description
documentId
Unique ID associated with the shared document.
documentName
Name of document that is being shared.
sharedto
[string] - List of user(s) to whom the document has been shared.


Sample Response

The following is the sample XML response for the above method:


<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/private/xml/shareDocument/8892000000065001">
  <result>

     <documentId>
8892000000065001</documentId>
     <documentName>CreatorFormInWriter</documentName>
        <sharedto>
        <user>"merrick"</user> 
        <user>"martha"</user>
        <user>"simon"</user>
     </sharedto>
  </result>
</response>


Equivalent JSON response


{
  "response":
   {
        "uri": "/api/private/json/shareDocument/8892000000065001",
        "result":
        {
           "documentId":"8892000000065001",
           "documentName":"CreatorFormInWriter",
           "sharedto":
            {
                "user":
                [
                     {

                        "merrick"
                     },
                     {
                        "martha"
                     },
                     {
                        "simon"
                     }
                ]
            }
         }
    }
}  


Errors


Sharing a document method may return general errors. Other HTTP error code may be 1404.
 


 RSS of this page