Copy Document
Purpose
To retrieve a copy of a specific document.
HTTP Request URL
https://{zohoapis_domain}/writer/api/v1/documents/{{document_id}}/copy
Path Parameters
Parameter | Data Type | Description |
Mandatory Parameters | ||
document_id | String | Specify the unique id for the document. |
Body Parameters
Parameter | Data Type | Description |
Optional Parameters | ||
document_name | String | Specify a unique name for the copied document. By default, the document name will be "Copy of the Original document name". |
format | String | Specify the output format in which the copied file needs to be stored. Supported formats are: docx / zdoc / doc / odt / html / pdf and more ... Note:
|
password | String | Specify a password if you would like to protect the copied document. Note: This option is applicable only for docx and pdf files. |
folder_id | String | Specify the folder_id in which you would like to store the copy of the document. By default, the copied document will be stored under 'My Folders'. |
options | { "include_changes":<String>, "include_comments":<String>, "include_template_settings":<Boolean> } | include_changes -> Specify how the track changed content needs to be reflected in copied file. The possible values are:
include_comments -> Specify if the comments needs to be included in the copied file or not. The possible values are:
Note: This parameter is applicable only for docx and pdf files. include_template_settings -> Specify if the automation configuration needs to be included in the copied file or not. The possible values are True or False.
|
options
Parameter | Type | Possible Values | Default Value |
include_changes | String | as_markups / all / none | none |
include_comments | String | all / none | none |
include_template_settings | Boolean | true/false | none |
Note:
- The comments present in the document will be reflected in the copied document based on the comment visibility permission provided for that particular document.
- You can check the possible errors list here.
Sample Request
Copiedcurl --location --request POST 'https://www.zohoapis.com/writer/api/v1/documents/ts7yz50a2a712d6ce4f979883e8d245f7af20/copy' \
--header 'Authorization: Zoho-oauthtoken 1000.fba8c52e62677133a9655f77b620e51e.7396c656e694d38c36e0acae21ed6278' \
--form 'document_name=Copy of New document'
Copiedparam = Map();
param.put("document_name","new name"); //optional
param.put("folder_id","4vf3a9d1632be6ead486482a0743a338*****"); //optional
param.put("password","StrongPassword"); //optional
param.put("format","zdoc"); //optional
optionsmap = map();
optionsmap.put("include_changes", "all"); //optional - possible values: all | as_markups | none
optionsmap.put("include_comments", "all"); //optional - possible values: all | none
param.put("options", optionsmap);
response = invokeurl
[
url :"https://zohoapis.com/writer/api/v1/documents/aoxw10d7094f66a484a9c9d627155beb*****/copy"
type :POST
parameters:param
connection:"<connection_name>"
];
info response;
Sample Response
Copied{
"role": "OWNER",
"modified_time_ms": 1589187982831,
"owner_id": "55576911",
"open_url": "https://{domain}/writer/open/5rh8dc5b791e93ec74a8c855138bc2a7d1442",
"is_favourite": false,
"last_opened_time_ms": 1589187982441,
"thumbnail_url": "https://{domain}/writer/thumbnail/5rh8dc5b791e93ec74a8c855138bc2a7d1442",
"document_id": "5rh8dc5b791e93ec74a8c855138bc2a7d1442",
"type": "document",
"title": "Copy of New document",
"lock_info": {
"status": false
},
"document_name": "Copy of New document",
"modified_time": "2020-05-11T09:06:22Z",
"library_id": 20,
"permissions": {
"can_read_fill": true,
"can_trash": true,
"can_share": true,
"can_edit": true,
"can_lock": true,
"can_copy": true,
"can_org_publish": true,
"can_read": true,
"is_admin": true,
"can_discard_lock": false,
"can_remove_share": false,
"can_publish": true,
"can_delete": false,
"can_restore": false,
"can_rename": true,
"can_favourite": true,
"can_leave": false,
"can_download": true,
"can_unlock": false
},
"download_url": "https://{domain}/api/v1/download/5rh8dc5b791e93ec74a8c855138bc2a7d1442",
"lastmodified_by": [
{
"email_id": "amelia@gmail.com",
"profile_photo": "https://{domain}/file?t=user&ID=1308724&fs=thumb",
"user_id": "1308724",
"timezone": "Asia/Kolkata",
"language": "en",
"display_name": "Zylker"
}
],
"final_info": {
"status": false
},
"parent_info": {
"folder_name": "My Folders",
"folder_link": "https://{domain}/home/teams/fnzpd538b91fe77cf476b924bf1578ffe4d3f/privatespace/folders/files"
},
"created_time": "2020-05-11T09:06:22Z",
"parent_folder_id": "folder",
"collaboration_id": "1203300249832967075",
"last_opened_time": "2020-05-11T09:06:22Z",
"version_id": "185909000000363002",
"created_by": "amelia",
"version": "1.0",
"created_time_ms": 1589187982441,
"product_type": 1,
"preview_url": "https://{domain}/writer/zwpreview/5rh8dc5b791e93ec74a8c855138bc2a7d1442",
"creator_id": "1308724",
"permalink": "https://{domain}/file/5rh8dc5b791e93ec74a8c855138bc2a7d1442",
"status": "active"
}