Content
View differences
Updated by Wieland Lindenthal over 3 years ago
Requirements:
* Authenticates and authorizes token as a parameter in the URL
* Check that token is still valid
* Check to which user it belongs and act on behalf of that user.
* Check that folder with that _file ID_ exists.
* Check if file with same name exists in that folder
* If true:
* overwrite parameter present?
* if true
* check that you have write access on that file
* if write allowed
* update file
* if write not allow
* return "Not allowed" error
* if false
* check that you (still) allowed to create the file
* find a unique file name that is similar (suffix with a number)
* write the file
* return
* `file_name`
* `file_id`
* overwrite parameter not present
* file already exists?
* if true:
* Cancel request and tell the client that we have a conflict
* if false:
* check that you (still) allowed to create the file
* write the file
* return
* `file_name`
* `file_id`
* if false:
* check that you (still) allowed to create the file
* write the file
* return
* `file_name`
* `file_id`
* Accepts POST(?)
* Route: `direct-upload/<token>`
* Multipart form data
* `overwrite` (optional)
* Allow CORS preflights (HTTP OPTION) requests (see [https://docs.nextcloud.com/server/latest/developer\_manual/digging\_deeper/rest\_apis.html#rest-apis)](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/rest_apis.html#rest-apis))
* Revoke the token after successful upload.
* Authenticates and authorizes token as a parameter in the URL
* Check that token is still valid
* Check to which user it belongs and act on behalf of that user.
* Check that folder with that _file ID_ exists.
* Check if file with same name exists in that folder
* If true:
* overwrite parameter present?
* if true
* check that you have write access on that file
* if write allowed
* update file
* if write not allow
* return "Not allowed" error
* if false
* check that you (still) allowed to create the file
* find a unique file name that is similar (suffix with a number)
* write the file
* return
* `file_name`
* `file_id`
* overwrite parameter not present
* file already exists?
* if true:
* Cancel request and tell the client that we have a conflict
* if false:
* check that you (still) allowed to create the file
* write the file
* return
* `file_name`
* `file_id`
* if false:
* check that you (still) allowed to create the file
* write the file
* return
* `file_name`
* `file_id`
* Accepts POST(?)
* Route: `direct-upload/<token>`
* Multipart form data
* `overwrite` (optional)
* Allow CORS preflights (HTTP OPTION) requests (see [https://docs.nextcloud.com/server/latest/developer\_manual/digging\_deeper/rest\_apis.html#rest-apis)](https://docs.nextcloud.com/server/latest/developer_manual/digging_deeper/rest_apis.html#rest-apis))
* Revoke the token after successful upload.