Creating Backups Of Your Files
In this short guide we will show you how to backup your files using the employee files API endpoint.
Step 1: Knowing your employees
Before you can just download all the files, you should retrieve a list of all your employees using the employees API endpoint.
You will need to do this, so that you know which files belong to which employee, should you ever need to access the backup.
Using the following api call, you will receive a list of your employees.
GET https://your-business-subdomain.onboard.org/services/api/v1/employees
The list should look something like this:
{
"entries": [
{
"id": "7bBJMyz2",
"employee_status_id": "1AayjkI2",
"supervisor_id": null,
"location_id": "29jLAnMs",
"department_id": "3Bkl2jAH",
"first_name": "John",
"last_name": "Doe",
"language": "en",
"gender": "male",
"email": "john.doe@privatemail.com",
"company_email": "john.doe@companymail.org",
"phone": "+39 1234567890",
"company_phone": "+39 0471 234567"
"photo_url": "https://www.onboard.org/assets/images/logo/onboard_logo_RGB-340.png",
"birthday": "1992-06-15",
"tax_number": "RSSMRA84A41F132U",
"employee_number": "123",
"created_at": "2023-12-31T09:32:31.262Z",
"updated_at": "2024-01-01T11:53:55.662Z"
},
{
"id": "xy6q5M6d",
"employee_status_id": "1AayjkI2",
"supervisor_id": null,
"location_id": "29jLAnMs",
"department_id": "3Bkl2jAH",
"first_name": "Jane",
"last_name": "Doe",
"language": "en",
"gender": "male",
"email": "jane.doe@privatemail.com",
"company_email": "jane.doe@randomcompany.org",
"phone": "+39 1234567890",
"company_phone": "+39 0471 234567"
"photo_url": "https://www.onboard.org/assets/images/logo/onboard_logo_RGB-340.png",
"birthday": "1990-01-02",
"tax_number": "RSSMRA84A41F132U",
"employee_number": "123",
"created_at": "2023-12-31T09:32:31.262Z",
"updated_at": "2024-01-01T11:53:55.662Z"
}
],
"current_page": 1,
"per_page": 30,
"total_entries": 2
}
You can now use this list to create a folder for every employee in it. By preceding the folder name with the employee id, you will later be able to assign the files to the correct folder.
A folder name could then look for example like this: 7bBJMyz2 - John Doe
.
Step 2: Folders
Just like in the onboard application itself, most files are inside folders to keep them categorized (please note that some files are not inside folders, and their employee_file_category_id is therefore null).
In onboard every employee shares the same folders, meaning they are equal for all employees. With the following api call you can request the lost of employee file categories (also known as "folders").
GET https://your-business-subdomain.onboard.org/services/api/v1/employee-file-categories
The response should look something like this:
{
"entries": [
{
"id": "A96ey16n",
"type_of": "signatures",
"name_de": "Signierte Dokumente",
"name_it": "Documenti firmati",
"name_en": "Signed documents",
"ancestor_id": null,
"depth": 0,
"subtree_ids": ["A96ey16n"],
"ancestor_ids": []
},
{
"id": "Lez8GJ6g",
"type_of": "application",
"name_de": "Bewerbungsunterlagen",
"name_it": "Documenti della candidatura",
"name_en": "Application documents"
"ancestor_id": null,
"depth": 0,
"subtree_ids": ["Lez8GJ6g"],
"ancestor_ids": []
},
{
"id": "Bj893Hm",
"type_of": "custom",
"name_de": "Sonstige Unterlagen",
"name_it": "Altri documenti",
"name_en": "Other documents",
"ancestor_id": null,
"depth": 0,
"subtree_ids": ["Bj893Hm"],
"ancestor_ids": []
}
],
"current_page": 1,
"per_page": 30,
"total_entries": 3
}
If you want to categorize the backed up files in the same way they are categorized in onboard, you can do so by creating folders for every employee file category inside every employee folder (please note that employee file categories can have a tree-like structure!). Your file structure could then look like this:
- 7bBJMyz2 - John Doe
- A96ey16n - Signed documents
- Lez8GJ6g - Application documents
- Bj893Hm - Other documents
- null - Uncategorized
- xy6q5M6d - Jane Doe
- A96ey16n - Signed documents
- Lez8GJ6g - Application documents
- Bj893Hm - Other documents
- null - Uncategorized
Step 3: Downloading the files
Since the links provided by the employee files API endpoint are only available temporarily, you should download them immediately after requesting them. You can request all employee files of your business, by using the following api call:
GET https://your-business-subdomain.onboard.org/services/api/v1/employee-files
The response should look something like this:
{
"entries": [
{
"id": "A96ey16n",
"employee_id": "7bBJMyz2"
"employee_file_category_id": "Lez8GJ6g",
"date": "2024-07-27",
"type_of": "custom",
"display_name": "MY CV",
"name": "MY CV",
"file_url": "http://assets.onboard.org/uploads/employee_file/file/vM7WRbqLmEjpOQyag6P0/cv.pdf",
"file_name": "cv.pdf",
"file_size": 75637,
"file_content_type": "application/pdf",
"created_at": "2024-09-12T14:25:18.181Z",
"updated_at": "2024-09-12T14:25:34.027Z"
},
{
"id": "Lez8GJ6g",
"employee_id": "xy6q5M6d",
"employee_file_category_id": null",
"date": "2024-08-27",
"type_of": "custom",
"display_name": "STCED.pdf",
"name": null,
"file_url": "http://assets.onboard.org/uploads/employee_file/file/AJV7KrRz2QAg2wYZD8gG/STCED.pdf",
"file_name": "STCED.pdf",
"file_size": 1041137,
"file_content_type": "application/pdf",
"created_at": "2024-09-12T14:25:18.181Z",
"updated_at": "2024-09-12T14:25:34.027Z"
}
],
"current_page": 1,
"per_page": 30,
"total_entries": 2
}
We can see that the employee files provided by the endpoint are in the category Lez8GJ6g - Application documents
and in no category respectively.
If we save both files to the correct folder, we will have made a successful backup of our files and our final folder structure should look like this:
- 7bBJMyz2 - John Doe
- A96ey16n - Signed documents
- Lez8GJ6g - Application documents
- cv.pdf
- Bj893Hm - Other documents
- null - Uncategorized
- xy6q5M6d - Jane Doe
- A96ey16n - Signed documents
- Lez8GJ6g - Application documents
- Bj893Hm - Other documents
- null - Uncategorized
- STCED.pdf