diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-06-26 15:17:38 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-06-26 15:17:38 -0400 |
commit | f62112983635a281108575bb69bb90df6bed68b7 (patch) | |
tree | 6e5cf4713e0ba1f5301376f568f0229ddd27a520 /doc | |
parent | 3d34681610854474cb9dbdd93886dbcf0e208a99 (diff) |
Added new API calls for project attachements
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api-json-rpc.markdown | 3 | ||||
-rw-r--r-- | doc/api-project-file-procedures.markdown | 221 | ||||
-rw-r--r-- | doc/api-task-file-procedures.markdown (renamed from doc/api-file-procedures.markdown) | 4 |
3 files changed, 225 insertions, 3 deletions
diff --git a/doc/api-json-rpc.markdown b/doc/api-json-rpc.markdown index 8e783e71..6498b0cc 100644 --- a/doc/api-json-rpc.markdown +++ b/doc/api-json-rpc.markdown @@ -58,7 +58,8 @@ Usage - [Automatic Actions](api-action-procedures.markdown) - [Tasks](api-task-procedures.markdown) - [Subtasks](api-subtask-procedures.markdown) -- [Files](api-file-procedures.markdown) +- [Task Files](api-task-file-procedures.markdown) +- [Project Files](api-project-file-procedures.markdown) - [Links](api-link-procedures.markdown) - [Internal Task Links](api-internal-task-link-procedures.markdown) - [External Task Links](api-external-task-link-procedures.markdown) diff --git a/doc/api-project-file-procedures.markdown b/doc/api-project-file-procedures.markdown new file mode 100644 index 00000000..fdc5da1a --- /dev/null +++ b/doc/api-project-file-procedures.markdown @@ -0,0 +1,221 @@ +Project File API Procedures +=========================== + +## createProjectFile + +- Purpose: **Create and upload a new project attachment** +- Parameters: + - **project_id** (integer, required) + - **filename** (integer, required) + - **blob** File content encoded in base64 (string, required) +- Result on success: **file_id** +- Result on failure: **false** +- Note: **The maximum file size depends of your PHP configuration, this method should not be used to upload large files** + +Request example: + +```json +{ + "jsonrpc": "2.0", + "method": "createProjectFile", + "id": 94500810, + "params": [ + 1, + "My file", + "cGxhaW4gdGV4dCBmaWxl" + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 94500810, + "result": 1 +} +``` + +## getAllProjectFiles + +- Purpose: **Get all files attached to a project** +- Parameters: + - **project_id** (integer, required) +- Result on success: **list of files** +- Result on failure: **false** + +Request example: + +```json +{ + "jsonrpc": "2.0", + "method": "getAllProjectFiles", + "id": 1880662820, + "params": { + "project_id": 1 + } +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 1880662820, + "result": [ + { + "id": "1", + "name": "My file", + "path": "1\/1\/0db4d0a897a4c852f6e12f0239d4805f7b4ab596", + "is_image": "0", + "project_id": "1", + "date": "1432509941", + "user_id": "0", + "size": "15", + "username": null, + "user_name": null + } + ] +} +``` + +## getProjectFile + +- Purpose: **Get file information** +- Parameters: + - **project_id** (integer, required) + - **file_id** (integer, required) +- Result on success: **file properties** +- Result on failure: **false** + +Request example: + +```json +{ + "jsonrpc": "2.0", + "method": "getProjectFile", + "id": 318676852, + "params": [ + "42", + "1" + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 318676852, + "result": { + "id": "1", + "name": "My file", + "path": "1\/1\/0db4d0a897a4c852f6e12f0239d4805f7b4ab596", + "is_image": "0", + "project_id": "1", + "date": "1432509941", + "user_id": "0", + "size": "15" + } +} +``` + +## downloadProjectFile + +- Purpose: **Download project file contents (encoded in base64)** +- Parameters: + - **project_id** (integer, required) + - **file_id** (integer, required) +- Result on success: **base64 encoded string** +- Result on failure: **empty string** + +Request example: + +```json +{ + "jsonrpc": "2.0", + "method": "downloadProjectFile", + "id": 235943344, + "params": [ + "1", + "1" + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 235943344, + "result": "cGxhaW4gdGV4dCBmaWxl" +} +``` + +## removeProjectFile + +- Purpose: **Remove a file associated to a project** +- Parameters: + - **project_id** (integer, required) + - **file_id** (integer, required) +- Result on success: **true** +- Result on failure: **false** + +Request example: + +```json +{ + "jsonrpc": "2.0", + "method": "removeProjectFile", + "id": 447036524, + "params": [ + "1", + "1" + ] +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 447036524, + "result": true +} +``` + +## removeAllProjectFiles + +- Purpose: **Remove all files associated to a project** +- Parameters: + - **project_id** (integer, required) +- Result on success: **true** +- Result on failure: **false** + +Request example: + +```json +{ + "jsonrpc": "2.0", + "method": "removeAllProjectFiles", + "id": 593312993, + "params": { + "project_id": 1 + } +} +``` + +Response example: + +```json +{ + "jsonrpc": "2.0", + "id": 593312993, + "result": true +} +``` diff --git a/doc/api-file-procedures.markdown b/doc/api-task-file-procedures.markdown index 930be733..51840bea 100644 --- a/doc/api-file-procedures.markdown +++ b/doc/api-task-file-procedures.markdown @@ -1,5 +1,5 @@ -API File Procedures -=================== +Task File API Procedures +======================== ## createTaskFile |