Skip to content

Commit

Permalink
Write Document for getting file information
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Sep 5, 2023
1 parent 612b2b2 commit 032f23b
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,108 @@ 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.
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://<nextcloud_host>/ocs/v1.php/apps/integration_openproject/fileinfo/<FILE_ID>
```
Upon success the response from the above curl request will be
```json
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": "OK",
"totalitems": <totalitems>,
"itemsperpage": <itemsperpage>
},
"data": {
"status": "OK",
"statuscode": 200,
"id": <FILE_ID>,
"name": <file_name>,
"mtime": <mtime>,
"ctime": <ctime>,
"mimetype": <mimetype>,
"size": <size>,
"owner_name": <owner_name>,
"owner_id": <owner_id>,
"trashed": <boolean>,
"modifier_name": <modifier_name>,
"modifier_id": <modifier_id>,
"dav_permissions": <dav_permissions>,
"path": <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://<nextcloud_host>/ocs/v1.php/apps/integration_openproject/filesinfo -X POST -d '{"fileIds":[<FILE_ID1>, <FILE_ID2> ,...]}'
```
Upon success the response from the above curl request will be
```json
{
"ocs": {
"meta": {
"status": "ok",
"statuscode": 100,
"message": "OK",
"totalitems": <totalitems>,
"itemsperpage": <itemsperpage>
},
"data": {
<FILE_ID1>: {
"status": "OK",
"statuscode": 200,
"id": <FILE_ID1>,
"name": <file_name>,
"mtime": <mtime>,
"ctime": <ctime>,
"mimetype": <mimetype>,
"size": <size>,
"owner_name": <owner_name>,
"owner_id": <owner_id>,
"trashed": <boolean>,
"modifier_name": <modifier_name>,
"modifier_id": <modifier_id>,
"dav_permissions": <dav_permissions>,
"path": <path>
},
<FILE_ID2>: {
"status": "OK",
"statuscode": 200,
"id": <FILE_ID1>,
"name": <file_name>,
"mtime": <mtime>,
"ctime": <ctime>,
"mimetype": <mimetype>,
"size": <size>,
"owner_name": <owner_name>,
"owner_id": <owner_id>,
"trashed": <boolean>,
"modifier_name": <modifier_name>,
"modifier_id": <modifier_id>,
"dav_permissions": <dav_permissions>,
"path": <path>
},
...
}
}
}
```
> Note: App `Activity` must be enabled in order to get the information of `<modifier_name>` and `<modifier_id>`.
## 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.

Expand Down

0 comments on commit 032f23b

Please sign in to comment.