Odyssee Mobile

API User Guide

Files are managed in a specific way that requires here some explanation. For exemple, on which entity the file is linked, is it a global file or not, his file name, the mime_type, etc.

All the files are saved in the entity "db_file". The content of the file is saved in the field db_file.file_content as a Byte Array. The rest of the fields on this table contains all the information of the files. For exemple, on which entity the file is linked, is it a global file or not, his file name, the mime_type, etc.

There are 3 types of files that you can find on the system.

  • Global Files

    These files belong to the Document Manager.

    There are available on the module "Document" but can be also shown inside some entities, like inside Company Details.

  • Linked Files

    These files belong to one single entity and only available inside the details of this entity (like the files related to one project).

  • Generated files

    These files are also linked to one single entity but have been not uploaded by the user but generated by the system. For exemple : the Job Approval PDF, Order PDF or Purchase Order PDF.

Let's see in details each of the type, what actions are allowed and which fields are mandatory

Global Files

The Document Manager is like a local file system, means with Folders and SubFolders. This is an easiest solution that sending files to your team by Email and ask them to organize them.

Each file belongs to a Folder (entity db_file_folder) or to the root (no db_file_folder specified). Folders handles hierachy level : a folder can have a parent. In this case it's a sub folder. You can specify an organization to give access to this file only on users that belongs to this organization.

Fields to use : file_name,name,file_content ,db_file_folder_id and optional sales_organization_id These files will be also shown inside entities depending on the settings of the folder.

Db_file_folder.is_sales : means the folders (and his files) will be shown on Company/Contact details

db_file_folder.is_service : means the folders (and his files) will be shown on Task/Project/Jobs details

Db_file_folder.is_articles : means the folders (and his files) will be shown on Article details

Linked Files

These files are uploaded by the user to a specify entity. For exemple Company/Contact/Task/Project/Jobs or Article.

The link to the entity are handled with the fields db_file.db_table_id and db_file.id_in_table.

You can uses the embedded entity db_file.db_table_name instead of db_file.db_table_id

Fields to use : file_name,name, file_content, db_table_id,id_in_table ,mime_type

Generated Files

These files are generated by the system and linked to an entity.

You cannot delete, update or add these kind of files. Only Get them.

Job Approval PDF : file_type_name = JOB_APPROVAL , db_table_name=job_approval (db_table_id=2E46771A-9129-4582-89CA-E4298E8C56BD), id_in_table=%job_approval.id%

Purchase Order PDF : file_type_name = PURCHASE_ORDERPDF, db_table_name=purchase_order (db_table_id=11FB461D-F186-4103-9F48-BE6287105C6C), id_in_table= %purchase_order.id%

Purchase Order PDF :file_type_name = PURCHASE_ORDERPDF, db_table_name=purchase_order (db_table_id=11FB461D-F186-4103-9F48-BE6287105C6C),id_in_table=%purchase_order.id%

Order PDF :file_type_name = ORDERPDF, db_table_name=order (db_table_id=4D8FC35C-B0BD-401D-B549-BE8906FAF4FE),id_in_table=%order.id%

Add files , 2 ways

  • As for all other entities, you can use the method Post/Put to Add/Update the entity. In this case, you have to provide the db_file.file_content as Byte Array and the file_name.
    You have also all the fields available and the embedded entity (Organization/DbFileFolder)

  • But if you need to use another standard way to upload file, you can use the method Add.

    This one can be used to upload multiple files in one single call and are compatible with tools and third party software like Fiddler where the files are attached on the request.

    This is the best way to avoid using the field file_content and the Byte Array