How to Migrate from Merge and Store API from V1 to V2?

How to Migrate from Merge and Store V1 to V2?

Why Migrate to Merge and Store V2 API?   

In Merge and Store V1 API, the response is returned only after the merge operation is fully completed. However, in Deluge scripts, the maximum allowed timeout is 40 seconds. In cases where the merge takes longer, this leads to a timeout and causes the DRE workflow to fail.
To overcome this limitation, Merge and Store V2 API was introduced. In V2:
  • The response is returned immediately with a virtual RID, even before the merge is completed.
  • The merge operation is scheduled in the backend, and the merged document will be stored using the virtual RID.
  • Users can proceed with their workflow using the virtual RID. Temporary content will be available until the final merge completes.
To track the merge status, you can use either of the following response fields:
  • merge_report_data_url
  • merge_report_url
The parameters and scopes remain the same as in Merge and Store V1. Additionally, V2 introduces a new optional key called merge_to inside the 'output_settings' parameter to define where the merged document should be stored.

How to Migrate from Merge and Store V1 to V2? 

To migrate from Merge and Store V1 to V2, follow these key changes:
  • Endpoint Update: Update the API endpoint to: https://{zohoapis_domain}/writer/api/v2/documents/{{document_id}}/merge/store
  • HTTP Method: POST 
  • Payload Format: Pass merge data and configuration inside a JSON request body.
  • Response Handling: Provides structured JSON responses with detailed status for each merged document.
For full API details, refer to the documentation: Merge and Store V2 API