V5 onwards only
This tutorial demonstrates how to download files from 12d Synergy via the RESTful API.
The steps include:
How to get a list of sub-folders for a given folder_id
How retrieve all file information (and their attributes) for a given folder_id
How to download a file by file_id (and any references if required)
The commands are provided in curl and can be run from the command prompt when the Synergy Server is running (or in a batch script).
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. Logging in and using Access Tokens for the API Requests
A bearer access token is required to be sent up with each request. The tutorial for getting and updating tokens is here: Generate PAT in Web client.
1.2. How to get all the Sub-folders for a given folder_id (and files within that folder)
The tutorial Uploading files to 12d Synergy covered how to get all of the top-level folders under a job. This next request will be able to retrieve sub-folders.
It can be found in the API documentation under Folders called 'Get Folder Items'. It will retrieve all the files in that folder and all the sub-folders.
Using information from the previous tutorial and the response from this request, a folder structure can be created in a recursive manner starting from the top.
The Folder IDString "3_1" is used in the example below. The IDString is made of two parts: the folder_id, followed by an underscore, followed by the server_id.
The IDString is part of the 'Entity ID' format.
Get Folder Items Request
curl --location --request GET "http://synergy.myserver.com/api/v1/folders/3_1/items" ^
--header "Authorization: Bearer <token>" ^
--header "Content-Type: application/json"
Below is the entire response from a folder that has 3 sub-folders and 9 files.
It contains an array called "SubFolders" and then an object called "Files", which contains an array called "Result".
Each File object within Result contains the ID for the file which is required for the download request. It also has information such as whether the file is checked out, if the file has references, the size of the file (in bytes) and the synergy path to the file.
The Subfolders array contains folder information such as the ID, Name, FolderType, NoOfSubFolders and whether or not InheritsFileAttributes or InheritsFileNamingRules = true.
Click in the line below to see the code.
Get Folder Items Response
{
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"ParentFolderID": null,
"JobID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"SubFolders": [
{
"ID": {
"_id": 61409,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61409_1"
},
"Name": "CAD Sheet Sets",
"ParentFolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"JobID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"Attributes": [],
"FileAttributes": null,
"FileChangeAttributes": null,
"CreatedByID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"CreatedOn": "2022-09-06T07:17:40.767",
"InheritsPermissions": true,
"UpdatedOn": "0001-01-01T00:00:00",
"FolderType": 0,
"ActiveCheckout": null,
"HasSubFolders": true,
"Has12dProjects": false,
"IsManagedFolder": false,
"NoOfSubFolders": 1,
"NumberOf12dProjects": 0,
"FolderState": 0,
"InheritsFileAttributes": true,
"InheritsFileNamingRules": false,
"LockInfo": null,
"Type": 1,
"Path": null,
"EntityObject": null
},
{
"ID": {
"_id": 61699,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61699_1"
},
"Name": "DWG with Xref",
"ParentFolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"JobID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"Attributes": [],
"FileAttributes": null,
"FileChangeAttributes": null,
"CreatedByID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"CreatedOn": "2022-11-11T04:45:36.4",
"InheritsPermissions": true,
"UpdatedOn": "0001-01-01T00:00:00",
"FolderType": 0,
"ActiveCheckout": null,
"HasSubFolders": true,
"Has12dProjects": false,
"IsManagedFolder": false,
"NoOfSubFolders": 1,
"NumberOf12dProjects": 0,
"FolderState": 0,
"InheritsFileAttributes": true,
"InheritsFileNamingRules": false,
"LockInfo": null,
"Type": 1,
"Path": null,
"EntityObject": null
},
{
"ID": {
"_id": 61411,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61411_1"
},
"Name": "STAGE 3 - GATAKERS SHEET SET ISSUE",
"ParentFolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"JobID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"Attributes": [],
"FileAttributes": null,
"FileChangeAttributes": null,
"CreatedByID": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"CreatedOn": "2022-09-06T07:20:35.05",
"InheritsPermissions": true,
"UpdatedOn": "0001-01-01T00:00:00",
"FolderType": 0,
"ActiveCheckout": null,
"HasSubFolders": false,
"Has12dProjects": false,
"IsManagedFolder": false,
"NoOfSubFolders": 0,
"NumberOf12dProjects": 0,
"FolderState": 0,
"InheritsFileAttributes": true,
"InheritsFileNamingRules": false,
"LockInfo": null,
"Type": 1,
"Path": null,
"EntityObject": null
}
],
"TDJobs": [],
"Files": {
"PageNumber": 1,
"PageSize": 20,
"TotalRows": 9,
"TotalPages": 1,
"Result": [
{
"ID": {
"_id": 128743,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "128743_1"
},
"FileName": "aurebesh_test.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 2,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-11-28T23:53:30.473",
"IsCheckedOut": false,
"LastModified": "2022-11-28T23:52:34.337",
"CreatedOn": "2020-09-30T23:57:06",
"Path": "My API Job/cad files/aurebesh_test.dwg",
"LatestVersion": 3,
"SizeReadable": "24.7KB",
"Size": 25327,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "",
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 128744,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "128744_1"
},
"FileName": "cad_file_with_attributes.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 2,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-11-28T23:57:55.467",
"IsCheckedOut": false,
"LastModified": "2022-11-28T23:57:49.19",
"CreatedOn": "2020-09-30T23:57:07.023",
"Path": "My API Job/cad files/cad_file_with_attributes.dwg",
"LatestVersion": 2,
"SizeReadable": "109.8KB",
"Size": 112472,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "”,
"HasReferences": true,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 128745,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "128745_1"
},
"FileName": "DrawingWithLayoutAttributes.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-06-21T01:35:22.573",
"IsCheckedOut": false,
"LastModified": "2020-09-25T00:59:56.02",
"CreatedOn": "2020-09-30T23:57:07.093",
"Path": "My API Job/cad files/DrawingWithLayoutAttributes.dwg",
"LatestVersion": 1,
"SizeReadable": "321.7KB",
"Size": 329468,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 128746,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "128746_1"
},
"FileName": "X-17BNE-0023 BASE.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-06-21T01:35:22.573",
"IsCheckedOut": false,
"LastModified": "2020-07-20T03:36:32",
"CreatedOn": "2020-09-30T23:57:07.243",
"Path": "My API Job/cad files/X-17BNE-0023 BASE.dwg",
"LatestVersion": 1,
"SizeReadable": "2.4MB",
"Size": 2505461,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 128747,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "128747_1"
},
"FileName": "X-17BNE-0023 SURVEY.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-06-21T01:35:22.577",
"IsCheckedOut": true,
"LastModified": "2020-07-20T03:32:39",
"CreatedOn": "2020-09-30T23:57:07.373",
"Path": "My API Job/cad files/X-17BNE-0023 SURVEY.dwg",
"LatestVersion": 1,
"SizeReadable": "19MB",
"Size": 19948628,
"ActiveCheckout": {
"checkout_user_name": "Bill Posters [ADMIN]",
"checkout_user_id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"checkout_time": "2022-11-11T04:46:39.927",
"machine_id": "a0dae20e-bb55-481f-999a-dcdea3f36e51@SYNERGY002" "
},
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 128748,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "128748_1"
},
"FileName": "X-A1_TITLEBLOCK.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-06-21T01:35:22.58",
"IsCheckedOut": true,
"LastModified": "2020-06-05T05:44:24.307",
"CreatedOn": "2020-09-30T23:57:08.15",
"Path": "My API Job/cad files/X-A1_TITLEBLOCK.dwg",
"LatestVersion": 1,
"SizeReadable": "130.2KB",
"Size": 133353,
"ActiveCheckout": {
"checkout_user_name": "Bill Posters [ADMIN]",
"checkout_user_id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"checkout_time": "2022-11-28T23:54:37.38",
"machine_id": "a0dae20e-bb55-481f-999a-dcdea3f36e51@SYNERGY002 "
},
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 138835,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "138835_1"
},
"FileName": "test for cancel save as.xlsx",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-07-07T02:21:02.66",
"IsCheckedOut": false,
"LastModified": "2022-07-07T02:19:13.553",
"CreatedOn": "2022-07-07T02:20:33.133",
"Path": "My API Job/cad files/test for cancel save as.xlsx",
"LatestVersion": 1,
"SizeReadable": "9.7KB",
"Size": 9966,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "Microsoft Excel Worksheet",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 138837,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "138837_1"
},
"FileName": "test_outside_synergy.xlsx",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-07-08T00:26:12.227",
"IsCheckedOut": false,
"LastModified": "2022-07-07T23:56:50.863",
"CreatedOn": "2022-07-07T23:49:53.09",
"Path": "My API Job/cad files/test_outside_synergy.xlsx",
"LatestVersion": 1,
"SizeReadable": "8.2KB",
"Size": 8428,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "Microsoft Excel Worksheet",
"FileIcon": "",
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 158838,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "158838_1"
},
"FileName": "X-A1_TITLEBLOCK v2.dwg",
"DisplayName": null,
"FolderID": {
"_id": 3,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "3_1"
},
"State": "None",
"LastChangeType": 1,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2022-07-12T07:08:06.21",
"IsCheckedOut": false,
"LastModified": "2022-07-12T07:07:58",
"CreatedOn": "2022-07-12T07:07:58",
"Path": "My API Job/cad files/X-A1_TITLEBLOCK v2.dwg",
"LatestVersion": 1,
"SizeReadable": "122.7KB",
"Size": 125680,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG File",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
}
]
}
}
1.3. How to get all File Information and Attributes for a given folder_id
This request can be found in the API documentation under Folders called 'Get folder files'
The file information retrieved is largely the same as the previous response with two main differences:
The "retrieve_attributes" parameter can be set to true, and they will show as an array of objects rather than null
The "show_deleted_files" parameter can be set to false to filter them out (the Property "State" will show as "Deleted" if the file is deleted and the parameter is set to true)
This response does not show sub-folders within the folder.
The example request below is using a folder_id returned from the previous response: the sub-folder called 'CAD Sheet Sets', with an IDString of "61409_1".
Get Folder Files Request
curl --location --request GET "http://synergy.myserver.com/api/v1/folders/61409_1/files?retrieve_attributes=true&page=1&page_size=10&filter=&show_deleted_files=true" ^
--header "Authorization: Bearer <token>" ^
--header "Content-Type: application/json"
Below is the response showing the folder has 4 files; 2 of them have attributes, 1 of them is checked out and 1 of them is deleted.
Basic attribute information is covered in the previous tutorial. The two attributes here are a different "type" than the ones shown in the previous tutorial. One is a Date attribute (type 3) and the other is a User attribute (type 5).
Click in the line below to see the code.
Get Folder Files Response
{
"PageNumber": 1,
"PageSize": 10,
"TotalRows": 4,
"TotalPages": 1,
"Result": [
{
"ID": {
"_id": 199174,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "199174_1"
},
"FileName": "1 Grading_A.dwg",
"DisplayName": null,
"FolderID": {
"_id": 61409,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61409_1"
},
"State": "None",
"LastChangeType": 2,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2023-02-02T04:37:26.58",
"IsCheckedOut": false,
"LastModified": "2020-02-13T01:34:52.073",
"CreatedOn": "2020-09-30T23:57:08.26",
"Path": "My API Job/cad files/CAD Sheet Sets/1 Grading_A.dwg",
"LatestVersion": 3,
"SizeReadable": "45KB",
"Size": 46073,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG 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": true,
"order": 1,
"read_only": false,
"reprompt_on_change": false,
"type": 3,
"value": {
"_value": "2023-01-31T09:07:53",
"enum_id": null,
"value_id": {
"_id": 152381,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "152381_1"
}
},
"visibility_constraint": null,
"workflow_id": null,
"attribute_id": {
"_id": 50466,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50466_1"
},
"name": "DateDrawn",
"display_name": "DateDrawn",
"id": {
"_id": 50466,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50466_1"
}
},
{
"auto_increment_start": 1,
"description": "",
"enum_items": null,
"input_mask": "",
"is_auto_increment": false,
"is_visible": true,
"optional": true,
"order": 2,
"read_only": false,
"reprompt_on_change": false,
"type": 5,
"value": {
"_contact_data": {
"is_user": true,
"companies": null,
"id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"first_name": "Bill",
"last_name": "Posters [ADMIN]",
"email": "bill.posters@mycompany.com",
"active": true,
"create_date": "2020-09-28T22:10:02.4",
"attributes": null,
"image_modified_date_time": "2020-09-28T22:10:04.153"
},
"enum_id": null,
"value_id": {
"_id": 152775,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "152775_1"
},
"_value": null
},
"visibility_constraint": null,
"workflow_id": null,
"attribute_id": {
"_id": 50510,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50510_1"
},
"name": "OriginalDrawingBy",
"display_name": "OriginalDrawingBy",
"id": {
"_id": 50510,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50510_1"
}
}
],
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 199175,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "199175_1"
},
"FileName": "2 GRADING_B.dwg",
"DisplayName": null,
"FolderID": {
"_id": 61409,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61409_1"
},
"State": "None",
"LastChangeType": 2,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2023-02-02T04:36:49.177",
"IsCheckedOut": false,
"LastModified": "2020-02-13T01:36:00.83",
"CreatedOn": "2020-09-30T23:57:08.3",
"Path": "My API Job/cad files/CAD Sheet Sets/2 GRADING_B.dwg",
"LatestVersion": 4,
"SizeReadable": "45.4KB",
"Size": 46490,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "DWG 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": true,
"order": 1,
"read_only": false,
"reprompt_on_change": false,
"type": 3,
"value": {
"_value": "2023-01-10T12:08:28",
"enum_id": null,
"value_id": {
"_id": 152382,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "152382_1"
}
},
"visibility_constraint": null,
"workflow_id": null,
"attribute_id": {
"_id": 50466,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50466_1"
},
"name": "DateDrawn",
"display_name": "DateDrawn",
"id": {
"_id": 50466,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50466_1"
}
},
{
"auto_increment_start": 1,
"description": "",
"enum_items": null,
"input_mask": "",
"is_auto_increment": false,
"is_visible": true,
"optional": true,
"order": 2,
"read_only": false,
"reprompt_on_change": false,
"type": 5,
"value": {
"_contact_data": {
"is_user": true,
"companies": null,
"id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"first_name": "Bill",
"last_name": "Posters [ADMIN]",
"email": "bill.posters@mycompany.com",
"active": true,
"create_date": "2020-09-28T22:10:02.4",
"attributes": null,
"image_modified_date_time": "2020-09-28T22:10:04.153"
},
"enum_id": null,
"value_id": {
"_id": 152774,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "152774_1"
},
"_value": null
},
"visibility_constraint": null,
"workflow_id": null,
"attribute_id": {
"_id": 50510,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50510_1"
},
"name": "OriginalDrawingBy",
"display_name": "OriginalDrawingBy",
"id": {
"_id": 50510,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "50510_1"
}
}
],
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 199176,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "199176_1"
},
"FileName": "Civil Metric Sheet Set.dst",
"DisplayName": null,
"FolderID": {
"_id": 61409,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61409_1"
},
"State": "None",
"LastChangeType": 2,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2023-02-02T04:37:58.943",
"IsCheckedOut": true,
"LastModified": "2020-03-04T05:36:05.297",
"CreatedOn": "2020-09-30T23:57:08.34",
"Path": "My API Job/cad files/CAD Sheet Sets/Civil Metric Sheet Set.dst",
"LatestVersion": 3,
"SizeReadable": "16.2KB",
"Size": 16589,
"ActiveCheckout": {
"checkout_user_name": "Bill Posters [ADMIN]",
"checkout_user_id": {
"_id": 1,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "1_1"
},
"checkout_time": "2023-02-02T04:46:21.787",
"machine_id": "a0dae20e-bb55-481f-999a-dcdea3f36e51@SYNERGY002"
},
"ActiveFolderCheckout": null,
"FileType": "AutoCAD Sheet Set",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
},
{
"ID": {
"_id": 199177,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "199177_1"
},
"FileName": "readme.txt",
"DisplayName": null,
"FolderID": {
"_id": 61409,
"_server_id": 1,
"_server_guid": "cd877c4c-ca8f-4476-83fe-9a2cf107621c",
"IDString": "61409_1"
},
"State": "Deleted",
"LastChangeType": 3,
"LastChangedBy": "Bill Posters [ADMIN]",
"LastChangedTime": "2023-02-02T04:37:06.19",
"IsCheckedOut": false,
"LastModified": "2023-02-02T04:37:06.19",
"CreatedOn": "2020-09-30T23:57:08.373",
"Path": "My API Job/cad files/CAD Sheet Sets/readme.txt",
"LatestVersion": 2,
"SizeReadable": "136B",
"Size": 136,
"ActiveCheckout": null,
"ActiveFolderCheckout": null,
"FileType": "Text Document",
"FileIcon": "”,
"HasReferences": false,
"IsLinked": false,
"LinkedPath": "",
"Attributes": null,
"ChangeAttributes": null,
"EntityObject": null
}
]
}
1.4. How to Download a File by file_id
This request can be found in the API documentation under Files, the description begins 'Download (stream) a file by ID'.
Using the information from the previous response, the request below is asking for the file called "1 Grading_A.dwg" with an IDString of "199174_1" and will be downloading it to C:\Temp.
The "LatestVersion" property from the File object (from the previous response) is used in the parameter "version"'.
If the file downloads incompletely as 1kb, it may mean that the Access Token has expired.
Download File Request
curl --location --request POST "http://synergy.myserver.com/api/v1/files/199174_1/download?version=3&with_references=false" ^
--header "Authorization: Bearer <token>" ^
--header "Content-Type: application/octet-stream" ^
--data-raw "" ^
--output "C:\temp\1 Grading_A.dwg"
1.5. How to Download a File with References
The "HasReferences" property from the File object will be true if the file has other files as references.
To download the file and the referenced files, do the following:
Change the extension of the file name (in the curl command) to .zip
Change the parameter "with_references" to true
The files will download to the assigned place in a zip file. Inside the zip is the file, and a folder called references that contains all the referenced files.