Choose where you’d like to start

Get Merge Fields from Zoho Writer

We've released an advanced version of this API that returns all the fields in the document along with its details. Click here to know more about getAllFields API.

Description

The zoho.writer.getMergeFields task is used to list all the merge fields inserted into a Zoho Writer document. This integration task is based on the Zoho Writer API - Get All Fields.

Note: On average, it takes about a minute to index a file/folder after it is created or updated. This indexing time can increase if the queue size increases. You will not get the expected result if you execute zoho.writer.getMergeFields task before the document from which you need to fetch merge fields is indexed.

Syntax

<response> = zoho.writer.getMergeFields(<document_id>, <connection>);
where:

 

ParamsData typeDescription

<response>

KEY-VALUE

The response returned by Zoho Writer. It represents the list of merge fields inserted into the specified document.

<document_id>

TEXT

The ID of the document from which the merge fields need to be fetched.

The document ID can be obtained from the URL of the document from which the merge fields need to be fetched. The URL is in the following format:
https://writer.zoho.com/writer/open/<document_id>

<connection>

TEXT

The link name of the connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory in order for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter until you manually delete the authtoken from accounts.
  • Add relevant scopes mentioned in Zoho Writer API while creating the connection.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example

The following script fetches the list of merge fields inserted into the specified document.

response = zoho.writer.getMergeFields("al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c", "writer_oauth_connection");

where:

response
The KEY-VALUE that represents the response returned by Zoho Writer. It represents the list of merge fields inserted into the specified document.
"al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c"
The TEXT that represents the ID of the document from which the merge fields need to be fetched.
"writer_oauth_connection"
The TEXT that represents the name of the connection.

Response Format

Success Response:

  • The success response will be returned in the following format:

      {
      {
      "rl_fields":[],
      "fields":["Start Time","End Time","Event Title","Location","Contact Email"]
      }

Failure Response

  • The failure response for improper document ID will be returned in the following format:

      {
      "error": {   "message": "Request URL not configured properly. Please check and try again",
      "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "response_generated_time": 1563961624177,
      "request_url": "https://writer.zoho.com/api/v1/documents//collaboration",
      "errorcode": "R2008"
      }
      }
  • The failure response when you try to fetch merge fields from a document that you do not have permission will be returned in the following format:

      {
      "error": {
      "message": "Permission denied. You are not authorized to perform this operation.",
      
    "documentation_url": "https://www.zoho.com/writer/help/api/v1/general-errors.html",
      "response_generated_time": 1563961602526,
      "request_url": "https://writer.zoho.com/api/v1/documents/al296XXXXXXXXXXXXXXXXXXXXXXXX6964add/collaboration",
      "errorcode": "R5010"
      }
      }

Related Links

Get Started Now

Execute