This tutorial demonstrates how to get a file by ID and a specific version via the RESTful API.
The steps include:
Get a file using the file ID and a specific version
Additional API documentation
To get a list of most of the API requests available, with the 12d Synergy server running, browse http://synergy.myserver.com/api-docs/ui/index.
(Replace synergy.myserver.com with the external server address and update the port numbers if necessary.)
1.1. Getting the Personal Access Token to access API
The tutorial for getting the PAT is here: Generate PAT in Web client.
1.2. Getting a file using the file ID and a specific version
This request can be found in the API documentation under Files marked 'Get a file by ID and version'.
Sample Request
curl --location 'http://synergy.myserver.com/api/v1/files/{file-id-here}/versions/{version-here}?retrieve_attributes=false' \
--header 'Authorization: Bearer <token-here>' \
--header 'Content-Type: application/json'
Here, retrieve_attributes can be set to true or false to include the attributes.
Below is a sample response of a file name b2.txt.
Click in the line below to see the code.
Sample Response
{
"ID": {
"_id": 180298,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3bg8139",
"IDString": "180298_1"
},
"FileName": "b2.txt",
"DisplayName": null,
"FolderID": {
"_id": 180175,
"_server_id": 1,
"_server_guid": "b993c72s9-bf98-490c-989d-5621e3b48139",
"IDString": "180175_1"
},
"State": "None",
"LastChangeType": 2,
"LastChangedBy": "",
"LastChangedTime": "2025-04-02T05:36:02.04",
"IsCheckedOut": false,
"LastModified": "2024-11-19T01:45:10.7",
"CreatedOn": "2024-10-29T13:10:14.157",
"Path": "Folder 1/Inner Folder/b2.txt",
"LatestVersion": 5,
"SizeReadable": "4B",
"Size": 4,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "TXT File",
"FileIcon": "",
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes":
{
"auto_increment_start": 1,
"description": "",
"enum_items": null,
"input_mask": "",
"is_auto_increment": false,
"is_visible": true,
"optional": false,
"order": 0,
"read_only": false,
"reprompt_on_change": false,
"type": 0,
"value": {
"_value": "12d 1233",
"enum_id": null,
"value_id": {
"_id": 160076,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",
"IDString": "160076_1"
}
},
"visibility_constraint": null,
"workflow_id": null,
"attribute_id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",
"IDString": "1_1"
},
"name": "To",
"display_name": "To",
"id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",
"IDString": "1_1"
}
},
{
"auto_increment_start": 1,
"description": "",
"enum_items": null,
"input_mask": "",
"is_auto_increment": false,
"is_visible": true,
"optional": false,
"order": 0,
"read_only": false,
"reprompt_on_change": false,
"type": 6,
"value": {
"_coordinate": {
"search_distance": 0.0,
"search_is_metric": true,
"search_wkt": "",
"x": 111.147540983607,
"y": 36.0725943869394
},
"enum_id": null,
"value_id": {
"_id": 160077,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",
"IDString": "160077_1"
},
"_value": null
},
"visibility_constraint": null,
"workflow_id": null,
"attribute_id": {
"_id": 10008,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",
"IDString": "10008_1"
},
"name": "Coordinates",
"display_name": "Coordinates",
"id": {
"_id": 10008,
"_server_id": 1,
"_server_guid": "b993c729-bf98-490c-989d-5621e3b48139",
"IDString": "10008_1"
}
}
],
"ChangeAttributes": null,
"EntityObject": {
"file_name": "b2.txt",
"version": 5,
"last_user_name": "",
"last_user_id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "b993c729-bf98-asds-989d-5621e3b48139",
"IDString": "1_1"
},
"last_change_time": "2025-04-02T05:36:02.04",
"last_change_type": 2,
"file_id": {
"_id": 180298,
"_server_id": 1,
"_server_guid": "b993c729-bf98-sadf-989d-5621e3b48139",
"IDString": "180298_1"
},
"folder_id": {
"_id": 180175,
"_server_id": 1,
"_server_guid": "b993c729-bf98-asdf-989d-5621e3b48139",
"IDString": "180175_1"
},
"active_check_out": null,
"active_folder_check_out": null,
"change_attribs": null,
"file_size": 4,
"has_file_access": false,
"file_access": 0,
"flattened_parent_attributes": null,
"path": "Folder 1/Inner Folder/b2.txt",
"has_references": false,
"has_folder_references": false,
"latest_version": 5,
"file_type": 0,
"link_source_id": null,
"link_path": "",
"preview_state": 1,
"is_link_source": false,
"file_modified_utc": "2024-11-19T01:45:10.7",
"file_created_utc": "2024-10-29T13:10:14.157",
"display_name": null,
"workflows": null,
"file_lock": null,
"is_referenced": false,
"file_store": {
"id": 1,
"name": "Primary Store",
"store_type": 0,
"creator": null,
"create_date": "0001-01-01T00:00:00",
"server_id": 0,
"server_name": null,
"is_remote": false,
"settings": {}
},
"has_layouts": false,
"extension_data": null,
"Microsoft365Session": null,
"attributes": null
},
"ActiveMs365Session": null
}