Get Documents from Zoho Writer
Table of Contents
Description
The zoho.writer.getDocuments task is used to fetch a list of all the documents from Zoho Writer. This integration task is based on the Zoho Writer API - Get List of Documents with Specified Parameters.
Syntax
<response> = zoho.writer.getDocuments(<category>, <offset>, <limit>, <sort_by>, <connection>);
Params | Data type | Description |
<response> | KEY-VALUE | The response returned by Zoho Writer. It represents the number of documents fetched and their metadata. |
<category> | TEXT | The category based on which the documents are filtered and fetched. The possible values for the parameter - category are as follows:
|
<offset> | NUMBER | The start index from which the documents will be fetched. The index value starts from 0. |
<limit> | NUMBER | The number of documents that will be fetched. Note: The maximum number of documents that can be fetched is 100. |
<sort_by> | TEXT | The order in which the documents will be fetched. The possible values for the parameter - sort_by are as follows:
|
<connection> | TEXT | The link name of the connection. Note:
|
Example
The following script fetches a list of first two recently created documents from Zoho Writer.
response = zoho.writer.getDocuments("all",0,2,"created_time","writer_oauth_connection");
where:
response
0
2
"created_time"
"writer_oauth_connection"
Response Format
Success Response
The success response will be returned in the following format:
{
"offset": 0,
"documents": [
{
"created_time": "2019-06-26T10:07:11Z",
"role": "OWNER",
"modified_time_ms": 1561543705220,
"parent_folder_id": "folder",
"collaboration_id": "11867XXXXXXXXX01382",
"last_opened_time": "2019-06-26T10:07:12Z",
"open_url": "https://writer.zoho.com/writer/open/al296XXXXXXXXXXXXXXXXXXXXXXXXXXaf66a",
"is_favourite": false,
"type": "document",
"document_id": "al296XXXXXXXXXXXXXXXXXXXXXXXXXXaf66a",
"last_opened_time_ms": 1561543632019,
"thumbnail_url": "https://writer.zoho.com/writer/thumbnail/al296XXXXXXXXXXXXXXXXXXXXXXXXXXaf66a",
"created_by": "John",
"document_name": "Integration tasks list",
"created_time_ms": 1561543631560,
"modified_time": "2019-06-26T10:08:25Z",
"preview_url": "https://writer.zoho.com/writer/preview/al296XXXXXXXXXXXXXXXXXXXXXXXXXaf66a",
"creator_id": "58XXXX70",
"download_url": "https://writer.zoho.com/api/v1/download/al296XXXXXXXXXXXXXXXXXXXXXXXXXaf66a",
"permalink": "https://docs.zoho.com/file/al296XXXXXXXXXXXXXXXXXXXXXXXXXaf66a",
"lastmodified_by": [
{
"email_id": "john@zylker.com",
"profile_photo": "https://contacts.zoho.com/file?t=user&ID=58XXXX70&fs=thumb",
"user_id": "58XXXX70",
"display_name": "John"
}
],
"status": "active"
},
{
"created_time": "2019-06-26T07:19:46Z",
"role": "OWNER",
"modified_time_ms": 1561533624688,
"parent_folder_id": "folder",
"collaboration_id": "11867XXXXXXXXX16931",
"last_opened_time": "2019-06-26T07:19:46Z",
"open_url": "https://writer.zoho.com/writer/open/al296XXXXXXXXXXXXXXXXXXXXXXXXXb4add",
"is_favourite": false,
"type": "document",
"document_id": "al296XXXXXXXXXXXXXXXXXXXXXXXXXb4add",
"last_opened_time_ms": 1561533586970,
"thumbnail_url": "https://writer.zoho.com/writer/thumbnail/al296XXXXXXXXXXXXXXXXXXXXXXXXXb4add",
"created_by": "John",
"document_name": "Document name",
"created_time_ms": 1561533586705,
"modified_time": "2019-06-26T07:20:24Z",
"preview_url": "https://writer.zoho.com/writer/preview/al296XXXXXXXXXXXXXXXXXXXXXXXXXb4add",
"creator_id": "58XXXX70",
"download_url": "https://writer.zoho.com/api/v1/download/al296XXXXXXXXXXXXXXXXXXXXXXXXXb4add",
"permalink": "https://docs.zoho.com/file/al296XXXXXXXXXXXXXXXXXXXXXXXXXb4add",
"lastmodified_by": [
{
"email_id": "john@zylker.com",
"profile_photo": "https://contacts.zoho.com/file?t=user&ID=58XXXX70&fs=thumb",
"user_id": "58XXXX70",
"display_name": "John"
}
],
"status": "active"
}
],
"total_count": 10,
"limit": 2
}The response will be returned in the following format when the offset value is higher than the number of documents present in Zoho Writer:
{
"offset": 10,
"documents": [
],
"total_count": 5,
"limit": 7,
"message": "You don't have any documents to list."
}
Failure Response
The failure response will be returned in the following format when you provide the limit value greater than 100:
{
"error": {
"parameter_name": "limit",
"message": "The limit you've given exceeds the maximum allowed limit of 100 documents.",
"documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
"response_generated_time": 1564648842968,
"request_url": "https://writer.zoho.com/api/v1/documents",
"errorcode": "R3033"
}
}