How to connect two programs in Next Cloud?
For example, put a photo in the files section and it will be shown in the program I made for NextCloud.
How to connect two programs in Next Cloud?
For example, put a photo in the files section and it will be shown in the program I made for NextCloud.
There are multiple ways to accomplish this.
In the front-end its generally easier, as you can just create a global Javascript object which other apps can use. For example your app can use OCA.Viewer.open()
to request the Viewer app to open a file.
In the backend, things get a bit tricker.
If you are integrating with a core nextcloud app or service then you can integrate with it using the server public API interfaces. So in your specific example the photos app can simply request the files from the API directly.
Roughly, something like this:
$userFolder = $this->rootFolder->getUserFolder($userId);
foreach ($userFolder->getDirectoryListing() as $node) {
// Check if node is an image...
// ...
}
If you need to integrate with an app that is not part of the public API then there are multiple approaches:
I am talking to @christianlupus about on this subject on this topic : How to work the OAuth2 with Nextcloud? - #17 by z4k
The subject is a little complicated.
For now, Nextcloud doesn’t an official response.