Content
View differences
Updated by Nabin Ale over 1 year ago
## **Description:**
According to changes on `group folder` app's **PR** [**https://github.com/nextcloud/groupfolders/commit/749f8005d39c9bbd49ddfc919d4e3d07362d20b6**](https://github.com/nextcloud/groupfolders/commit/749f8005d39c9bbd49ddfc919d4e3d07362d20b6)
[(link)](https://community.openproject.org/\(link\)) , the API endpoint for `group folders` has changed. changed.
The previous endpoint below master (stable31):
```bash
http://<nextcloud31-host>/index.php/apps/groupfolders/folder
```
In stable31, this has been changed to:
```bash
http://<nextcloud31-host>/ocs/v2.php/apps/groupfolders/folder
```
This means the `index.php` based endpoint no longer works in stable31, and the new `ocs` endpoint need to be used.
The `index.php` endpoint still works for below stable31 (e.g., stable30 and earlier)
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><tbody><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Version</p></th><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">index.php</code> endpoint</p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">ocs</code>endpoint</p></td></tr><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">stable 31(master)</p></th><td class="op-uc-table--cell"><p class="op-uc-p">Doesn't work</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Work</p></td></tr><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">stable 30, stable 29, stable28, stable 27</p></th><td class="op-uc-table--cell"><p class="op-uc-p">work</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Doesn't work</p></td></tr></tbody></table></figure>
## **Additional Impact:**
This change also affects `openproject`, which interacts with the group folder API for some operation like groupfolders creation.
Any operations in `openproject` that rely on the `index.php` endpoint for group folders will not works after upgrading Nextcloud and groupfolder to `stable31`.
## Steps to Reproduce:
1. Make a POST request in stable31 using the `index.php` endpoint.
```console
// tries request for creation of group folder
curl -u <user>:<password> -X POST "http://<nextcloud31-host>/index.php/apps/groupfolders/folders" \
-H "OCS-APIRequest: true" \
-F "mountpoint=hello"
```
2\. Observe that a following return response:
`<p class='hint'>The page could not be found on the server.</p>`
3\. Make a same request using the ocs endpoint on stable 31
```console
// tries request for creation of group folder
curl -u admin:admin -X POST "http://<nextcloud31-host>/ocs/v2.php/apps/groupfolders/folders" \
-H "OCS-APIRequest: true" \
-F "mountpoint=hello"
```
4\. The request is successfully processed.
## Possible Solution:
In the codebase, there can be configure the API endpoints differently based on the nextcloud version:
1. **For only** `stable31(master)`:
* Switch from the `index.php` endpoint to the OCS endpoint.
2. **For other versions (**`stable27`**,** `stable28`**,** `stable29`**,** `stable30`**)**:
* use the `index.php` endpoint.
According to changes on `group folder` app's **PR** [**https://github.com/nextcloud/groupfolders/commit/749f8005d39c9bbd49ddfc919d4e3d07362d20b6**](https://github.com/nextcloud/groupfolders/commit/749f8005d39c9bbd49ddfc919d4e3d07362d20b6)
The previous endpoint below master (stable31):
```bash
http://<nextcloud31-host>/index.php/apps/groupfolders/folder
```
In stable31, this has been changed to:
```bash
http://<nextcloud31-host>/ocs/v2.php/apps/groupfolders/folder
```
This means the `index.php` based endpoint no longer works in stable31, and the new `ocs` endpoint need to be used.
The `index.php` endpoint still works for below stable31 (e.g., stable30 and earlier)
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><tbody><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Version</p></th><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">index.php</code> endpoint</p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">ocs</code>endpoint</p></td></tr><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">stable 31(master)</p></th><td class="op-uc-table--cell"><p class="op-uc-p">Doesn't work</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Work</p></td></tr><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">stable 30, stable 29, stable28, stable 27</p></th><td class="op-uc-table--cell"><p class="op-uc-p">work</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Doesn't work</p></td></tr></tbody></table></figure>
## **Additional Impact:**
This change also affects `openproject`, which interacts with the group folder API for some operation like groupfolders creation.
Any operations in `openproject` that rely on the `index.php` endpoint for group folders will not works after upgrading Nextcloud and groupfolder to `stable31`.
## Steps to Reproduce:
1. Make a POST request in stable31 using the `index.php` endpoint.
```console
// tries request for creation of group folder
curl -u <user>:<password> -X POST "http://<nextcloud31-host>/index.php/apps/groupfolders/folders" \
-H "OCS-APIRequest: true" \
-F "mountpoint=hello"
```
2\. Observe that a following return response:
`<p class='hint'>The page could not be found on the server.</p>`
3\. Make a same request using the ocs endpoint on stable 31
```console
// tries request for creation of group folder
curl -u admin:admin -X POST "http://<nextcloud31-host>/ocs/v2.php/apps/groupfolders/folders" \
-H "OCS-APIRequest: true" \
-F "mountpoint=hello"
```
4\. The request is successfully processed.
## Possible Solution:
In the codebase, there can be configure the API endpoints differently based on the nextcloud version:
1. **For only** `stable31(master)`:
* Switch from the `index.php` endpoint to the OCS endpoint.
2. **For other versions (**`stable27`**,** `stable28`**,** `stable29`**,** `stable30`**)**:
* use the `index.php` endpoint.