For a class project, I’m building a mobile app for Nextcloud Polls. I’m using the rest API to get the polls and show them to the user. When it comes to allow the user to interact with a certain poll, I’m annoyed: using /api/v1.0/poll/{pollId} only gives me the configuration of the poll, but not other information, like the permissions (addOption, allAccess, etc.) or the current user (isLoggedIn, isOwner, etc.). The only way I found is to use /api/v1.0/polls which loads every poll and gives those information but it is quite inefficient (because I only need one poll and it might load dozens of them).
My question is : how can I get the permissions and current user for a single poll without loading every poll?
(I saw here there is a way to use /poll/{pollId}/poll, but I don’t understand how to make it work outside of a browser. If someone could show me a curl or a Java HttpURLConnection working example using an URL like https://example.com/index.php/apps/polls/poll/{pollId}/poll, it would also solve my problem.)
The REST calls are summarized in the route.php. I have not checked each route but it seems that these are the only ones with CSRF check disabled. This means, only the routes are those with the /api prefix.
I would suggest to contact the dev of the poll app (dartcafe) and ask if one could augment the API with either one additional API endpoint to get the meta data or augment also the existing endpoint with the meta data. The fastest way to get there is to provide a PR .
By the way: the fetching of all polls should not impose too much of load on the server. So, requesting all as a workaround and filtering out the relevant ones, might be doable in the meantime.