Content
View differences
Updated by Wieland Lindenthal over 4 years ago
# This specification is "Work in progress" an has not yet finished.
## Nextcloud file identifiers in OpenProject
In Nextcloud every file has an `id` and a `fileid`. The `id` differentiates a file from another within the same Nextcloud instance. The `fileid` in contrast is globally unique as it is a composition of the unique Nextcloud instance ID and the file's `id`. More information on this [here.](https://help.nextcloud.com/t/difference-between-id-and-fileid-in-webdav/91414) In OpenProject we use the `fileid` as we might want to support multiple Nextcloud instances in the future and still want to have a simple way to query on them. By using the `fileid` we only need one value to identify a file and not two (file id and instance id).
## File (link) resources
`File` resources in OpenProject describe links between resources in OpenProject (work packages, wiki pages, etc.) and their representation in a file store, i.e. a file in Nextcloud or in a Google Drive.
### Example:
_"Get * Return all files linked to work packages in project 5 that are stored in file store 1"_
For readability reasons we chose to show the URL params not URL encoded in this example. The params must be URL encoded first if you want to use them in a real example.
`/api/v3/files?filters=[{"resource_type":{"operator":"=","values":["WorkPackage"]}},{"project_id":{"operator":"=","values":["5"]}},{"file_store":{"operator":"=","values":["1"]}}]`
This will return a collection of work package resources.
## Work packages that are related to a Nextcloud "fileid"
To query all work packages that are linked to a Nextcloud file you need to apply the filter `nextcloudFileid` to the `work_packages` API endpoint. The filter allows only one operator `=` and multiple `fileid`s as values.
### Example:
_"Get ID
* Return all work packages files that are related to a Nextcoud_ `_fileid_`_"_
For readability reasons we chose to show the URL params not URL encoded in this example. The params must be URL encoded first if you want to use them in a real example.
`/api/v3/work_packages?filters=[{"nextcloudFileid":{"operator":"=","values":["00001234","00001235"]}}]`
This will return a collection of work package resources.
## **Files that are related to a work package**
To query all linked files of a work package
## Nextcloud file identifiers in OpenProject
In Nextcloud every file has an `id` and a `fileid`. The `id` differentiates a file from another within the same Nextcloud instance. The `fileid` in contrast is globally unique as it is a composition of the unique Nextcloud instance ID and the file's `id`. More information on this [here.](https://help.nextcloud.com/t/difference-between-id-and-fileid-in-webdav/91414) In OpenProject we use the `fileid` as we might want to support multiple Nextcloud instances in the future and still want to have a simple way to query on them. By using the `fileid` we only need one value to identify a file and not two (file id and instance id).
## File (link) resources
`File` resources in OpenProject describe links between resources in OpenProject (work packages, wiki pages, etc.) and their representation in a file store, i.e. a file in Nextcloud or in a Google Drive.
### Example:
_"Get
For readability reasons we chose to show the URL params not URL encoded in this example. The params must be URL encoded first if you want to use them in a real example.
`/api/v3/files?filters=[{"resource_type":{"operator":"=","values":["WorkPackage"]}},{"project_id":{"operator":"=","values":["5"]}},{"file_store":{"operator":"=","values":["1"]}}]`
This will return a collection of work package resources.
## Work packages that are related to a Nextcloud "fileid"
To query all work packages that are linked to a Nextcloud file you need to apply the filter `nextcloudFileid` to the `work_packages` API endpoint. The filter allows only one operator `=` and multiple `fileid`s as values.
### Example:
_"Get
* Return
For readability reasons we chose to show the URL params not URL encoded in this example. The params must be URL encoded first if you want to use them in a real example.
`/api/v3/work_packages?filters=[{"nextcloudFileid":{"operator":"=","values":["00001234","00001235"]}}]`
This will return a collection of work package resources.
## **Files that are related to a work package**
To query all linked files of a work package