I have installed an app from the store for groups folders, and it works.
Now I would like to use the API (see here: https://github.com/nextcloud/groupfolders) to perform some actions from my website. What I want to do is to automatically create and assign a group folder according to the group ID.
Sadly, I can’t manage the APi to work… it returns me that the document does not exist(?)
Can someone help me?
Could you post your OCS calls?
i tried with many methods using curl within php…
but nothing worked.
i was testing the GET to return the list of existing folders
This works for you?
curl -X GET -H “OCS-APIRequest:true” -v http://user:pass@IP/nextcloud/index.php/apps/groupfolders/folders
How can I use that in php?
<?php curl -X GET -H “OCS-APIRequest:true” -v http://user:pass@IP/nextcloud/index.php/apps/groupfolders/folders ?>
will never work
Ah ok, I’m using it in a terminal command line.
Sadly I don’t have any curl command terminal
Trying to access to this link returns me this:
CSRF check failed
@For other members:
The problem seems to be the header OCS-APIRequest: true that must be sent.
I managed to get a response using this code:
// Create a stream
$opts = array(
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" .
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('https://user:pass@IP/nextcloud/index.php/apps/groupfolders/folders', false, $context);
OCS-APIRequest: true that must be sent.
Yes, you have to set that for sure.
did you manage to make it work ?
I get a ipadress/nextcloud/index.php/apps/groupfolders/folders: event not found