diff --git a/README.md b/README.md index 32c4fff39..334449daa 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,109 @@ bash integration_setup.sh > Note: these credentials are only used by the script to do the setup. They are not stored/remembered. +## Get file information +We have two endpoints `fileinfo` and `filesinfo` from which we can get the information of a single or multiple files. + +### Requirements +This endpoint has a soft dependency on Nextcloud's [Activity](https://github.com/nextcloud/activity) app. In the absence of the Activity app the response fields like `modifier_name` , `modifier_id` will be returned as null. So, it is encouraged to have Activity app installed and enabled. + +1. **Get information of single file**: +Send the `GET` request to `fileinfo` endpoint with `FILE_ID` of the file to retrieve information. + + ```bash + curl -H "Accept: application/json" -H "OCS-APIRequest: true" -u USER:PASSWD http:///ocs/v1.php/apps/integration_openproject/fileinfo/ + + ``` + Upon success the response from the above curl request will be + ```json + { + "ocs": { + "meta": { + "status": "ok", + "statuscode": 100, + "message": "OK", + "totalitems": , + "itemsperpage": + }, + "data": { + "status": "OK", + "statuscode": 200, + "id": , + "name": , + "mtime": , + "ctime": , + "mimetype": , + "size": , + "owner_name": , + "owner_id": , + "trashed": , + "modifier_name": , + "modifier_id": , + "dav_permissions": , + "path": + } + } + } + ``` +2. **Get information of multiple files**: +Send the `POST` request to `filesinfo` endpoint with data `fileIds` of the files to retrieve information. + + ```bash + curl -H "Accept: application/json" -H "Content-Type:application/json" -H "OCS-APIRequest: true" -u USER:PASSWD http:///ocs/v1.php/apps/integration_openproject/filesinfo -X POST -d '{"fileIds":[, ,...]}' + + ``` + Upon success the response from the above curl request will be + ```json + { + "ocs": { + "meta": { + "status": "ok", + "statuscode": 100, + "message": "OK", + "totalitems": , + "itemsperpage": + }, + "data": { + : { + "status": "OK", + "statuscode": 200, + "id": , + "name": , + "mtime": , + "ctime": , + "mimetype": , + "size": , + "owner_name": , + "owner_id": , + "trashed": , + "modifier_name": , + "modifier_id": , + "dav_permissions": , + "path": + }, + : { + "status": "OK", + "statuscode": 200, + "id": , + "name": , + "mtime": , + "ctime": , + "mimetype": , + "size": , + "owner_name": , + "owner_id": , + "trashed": , + "modifier_name": , + "modifier_id": , + "dav_permissions": , + "path": + }, + ... + } + } + } + ``` + ## Direct upload There's an end-point `direct-upload` available which can be used for direct-upload. There's two steps to direct upload. First we need to get the `token`. Then use the token in the direct upload request.