Repository navigation
Feature Request: Expand API capabilities #1854
Replies: 1 comment 2 replies
|
Hi, thanks for the detailed request, it was easy to follow. Everything below will be in the next release. Point 4 is done. GET /notes and GET /notes/{id} now return kanban_completed (a boolean) and kanban_completed_at (when the card was marked, or null). They also return pinned, which was not there before either. Point 2 is done with GET, PUT and DELETE /workspaces/{name}/shares. PUT takes {"allowed_users": [2, 3], "read_only_users": [3]} and replaces the list, an empty allowed_users stops sharing, and all three answer with the stored state, including the username and permission of each account. The rules are those of the Share dialog in the settings, and only the owner of the account can use them. Point 1 is done with a header rather than a new parameter. Send X-User-ID with the owner_id from /shared/with-me and X-Poznote-Shared-Workspace with the workspace name (percent-encoded UTF-8 for names outside ASCII), with the user's own app password. The request then behaves exactly like the web interface when the workspace is opened from its menu. Lists are limited to that workspace, notes and folders of other workspaces answer 403, a read-only share refuses every write, and what belongs to the owner's account (trash, settings, public links, backups) stays out of reach. The share is checked again on every request, so revoking it takes effect immediately. The /users, /system and /shared endpoints ignore the header and always act on the caller's own account, so you can send both headers on every call. For point 3, mentions go through point 1. GET /mentions already gives owner_user_id, workspace and note_id, and GET /notes/{id} with the two headers returns the note, so I did not add a second read endpoint. For direct shares I used the share token rather than owner and note ids, since that is how the shared page addresses them. GET /shared/with-me/notes/{token} returns the note with its content, GET /shared/with-me/folders/{token} returns the folder, its subfolders and their notes, and GET /shared/with-me/folders/{token}/notes/{noteId} returns one note of that folder. They apply the same checks as the shared page, and anything that does not match answers 404. Each attachment comes with a url that works with the user's app password. A note share that also has a password answers 403 share_password_required with its URL, because an API client has no page to type the password in, so that case still opens in the browser. I am not doing point 5. Since 7.0, full-page drawings can no longer be created and are only kept for existing notes, so giving them a public endpoint would go the wrong way. Diagrams inserted in a note are part of the note's content and change through PATCH /notes/{id}. You are right that api_save_excalidraw.php is internal and may change, so I would not build on it. Everything is documented in docs/API-REST.md (see "Workspaces Shared With You", "Workspace Shares" and the three new sections under "List Items Shared With Me") and in the Swagger page of the instance. I hope it will work for you that way. 😊 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi Tim!
I’d like to propose an addition to the existing API — provided, of course, that you don’t find my request inappropriate. I need this to implement certain features in an unofficial app, PozNote Mobile.
Let me clarify these terms:
"Mentions" refers to notes in shared workspaces that contain your
@username. The app displays these as a list, accompanied by an unread count. "Shared with me" includes notes, folders, and workspaces that have been shared with you, as well as any copies you’ve received (found in folders labeled "Received from…").All reactions