Zoho Writer > Writer - REST API Methods > ZW - Upload an image to the document

ZW - Upload an image to the document

Tags:  



To upload an image in your Zoho Writer account.



Request URL POST Method

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

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

Request parameters :

To upload an image in Zoho Writer account we need to submit a form data to Writer with the following fields:

Field
Description
content
Encode the image content using base64encoding before uploading to Zoho Writer.
format
Specify the type of the image to uploaded (ex - jpg, gif).


Sample Form (POST Method)


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

<input type="hidden" name="content" value="[base64 encoded image]">

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

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

</form>



* It is mandatory to pass the apikey and ticket parameters to access the UploadImage api.
* The image should be encoded using base64encoding before passing the image content as input parameter.


Response fields

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

Field
Description
url
Gets the image location from where it is to be uploaded to Zoho Writer.


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/image/upload">
  <result>

     <url>
http://writer.zoho.com/ImageDisplay.im?name=testimage.jpg&accId=60000000145</url>
  </result>
</response>


Equivalent JSON response



{
  "response":
   {
        "uri": "/api/private/json/image/upload",
        "result":
        {
   
            "
url":"http://writer.zoho.com/ImageDisplay.im?name=testimage.jpg&accId=60000000145
        }
    }
}  


Errors


Uploading an image method may return general & input errors. Other HTTP error code may be 1500 & 1802.  


 RSS of this page