qownnotesapi icon indicating copy to clipboard operation
qownnotesapi copied to clipboard

API for other apps?

Open tonymurray opened this issue 3 years ago • 5 comments

Hello - would it be possible to use this app to provide API access to notes from (web)apps?.

Context: I am currently experimenting with Svelte / Node reading/writing notes. I have tried via the native Nextcloud WebDAV API. There are issues with CORS headers - I understand the native Nextcloud API was not designed for the 'front end', though it does works OK from a 'backend' node server.

tonymurray avatar Jun 27 '22 13:06 tonymurray

It works perfectly fine to directly use webdav on the frontend. Key is authentication to the Nextcloud server. I wrote https://apps.nextcloud.com/apps/webapppassword to generate temporary tokens for web-apps, there is a link to an example on the page.

pbek avatar Jun 27 '22 17:06 pbek

Thanks for the pointers. I am always still getting CORS issues in the browser context, but same code suceeds in the backend (i.e. node server). I added in the WebAppPassword 'Allowed origins' - though not working so far. I am using the following node library https://www.npmjs.com/package/webdav. Will try your example maybe next.

tonymurray avatar Jul 04 '22 12:07 tonymurray

Did you configure the origins, that should be able to access the nextcloud server?

pbek avatar Jul 04 '22 12:07 pbek

Hi - yes, - currently just development addresses: http://localhost:3000,http://localhost:3003

tonymurray avatar Jul 05 '22 10:07 tonymurray

You might have issues accessing https (your nextcloud server) from http.

pbek avatar Jul 05 '22 13:07 pbek