136 lines
3.7 KiB
Markdown
136 lines
3.7 KiB
Markdown
# Node reference
|
||
|
||
Package: **`node-red-contrib-nextcloud-ocs`** (see `nodes/nextcloud-ocs/package.json`).
|
||
|
||
All API nodes require a **nextcloud-config** configuration node unless noted.
|
||
|
||
## nextcloud-config
|
||
|
||
Configuration node — not placed on flows alone.
|
||
|
||
| Field | Description |
|
||
|-------|-------------|
|
||
| Name | Label in the editor |
|
||
| Nextcloud URL | Base URL, e.g. `https://cloud.example.com` |
|
||
| Username | Nextcloud account name |
|
||
| Password | **App password** (stored encrypted) |
|
||
|
||
## ocs-api
|
||
|
||
Generic OCS/HTTP caller.
|
||
|
||
| Config | Default |
|
||
|--------|---------|
|
||
| Endpoint | `/ocs/v2.php/cloud/user` |
|
||
| Method | `GET` |
|
||
|
||
**Runtime:** `msg.endpoint`, `msg.method`, `msg.body`, `msg.headers`.
|
||
|
||
## collectives
|
||
|
||
Nextcloud **Collectives** app. Operations use ids like `collective:list`, `page:create`, `share:updatePageShare`, etc.
|
||
|
||
Categories include: collectives, pages, trash, shares, templates, tags, user settings, sessions, public (token) APIs, search.
|
||
|
||
~80 operations — see `collectives.js` `OPERATIONS` for the full list.
|
||
|
||
## file-operations
|
||
|
||
| Operation | Protocol |
|
||
|-----------|----------|
|
||
| `list`, `get`, `upload`, `mkdir`, `move`, `copy`, `delete` | WebDAV `/remote.php/dav/files/{user}/…` |
|
||
| `listShares`, `createShare`, `deleteShare` | OCS sharing API |
|
||
| `fileInfo`, `favorites` | OCS files API |
|
||
|
||
Path placeholders: `{user}`, `{folder}`, `{path}`, `{id}`.
|
||
|
||
## mail
|
||
|
||
Mail app OCS endpoints (send, list messages, accounts, etc.). See `mail.js`.
|
||
|
||
## tables
|
||
|
||
Tables app — tables, views, rows, columns, shares. See `tables.js`.
|
||
|
||
## talk
|
||
|
||
Talk (Spreed) — rooms, messages, reactions, polls, bots, breakout rooms, etc. Largest node (~80+ operations). See `talk.js`.
|
||
|
||
## webhooks
|
||
|
||
Webhook Listeners app:
|
||
|
||
| Operation | Method |
|
||
|-----------|--------|
|
||
| `webhook:list` | GET |
|
||
| `webhook:get` | GET |
|
||
| `webhook:create` | POST |
|
||
| `webhook:update` | POST |
|
||
| `webhook:delete` | DELETE |
|
||
| `webhook:deleteByApp` | DELETE |
|
||
|
||
## dashboard
|
||
|
||
Dashboard widgets API. See `dashboard.js`.
|
||
|
||
## dav
|
||
|
||
DAV-related OCS (direct links, out-of-office). See `dav.js`.
|
||
|
||
## core
|
||
|
||
Nextcloud **core** OCS and related APIs (~50 operations), including:
|
||
|
||
- Status, capabilities, app passwords
|
||
- Navigation, profile, hover card
|
||
- Collaboration resources, references, previews, avatars
|
||
- CSRF, login flow v2, wipe, OCM discovery
|
||
- Unified search, task processing, text processing
|
||
- Translation, text-to-image, teams
|
||
|
||
Operation ids use prefixes: `status:`, `capabilities:`, `appPassword:`, `search:`, `task:`, etc. See `core.js`.
|
||
|
||
## oauth2
|
||
|
||
OAuth2 client management OCS. See `oauth2.js`.
|
||
|
||
## provisioning
|
||
|
||
User and group provisioning API. See `provisioning.js`.
|
||
|
||
## filesharing
|
||
|
||
Dedicated file sharing OCS (beyond WebDAV in file-operations). See `filesharing.js`.
|
||
|
||
## userstatus
|
||
|
||
User status (emoji/message). See `userstatus.js`.
|
||
|
||
## settings
|
||
|
||
User and admin settings OCS. See `settings.js`.
|
||
|
||
---
|
||
|
||
## Common message properties
|
||
|
||
| Property | Used by |
|
||
|----------|---------|
|
||
| `msg.operation` | All operation-based nodes |
|
||
| `msg.payload` | Response body (output) |
|
||
| `msg.statusCode` | HTTP status (output) |
|
||
| `msg.error` | Error string on failure |
|
||
|
||
Path parameters are typically available as `msg.<name>` matching the placeholder (e.g. `msg.collectiveId`, `msg.pageId`, `msg.webhookId`).
|
||
|
||
Body fields configured in the editor can often be overridden via `msg.body` object or node-specific `msg.body*` fields — check each node’s `buildBody` / handler in the `.js` file.
|
||
|
||
## Adding a new operation
|
||
|
||
1. Add entry to `OPERATIONS` in the relevant `.js` file.
|
||
2. Add dropdown option and fields in the matching `.html` file.
|
||
3. Bump `version` in `package.json`.
|
||
4. Rebuild Docker image and restart container.
|
||
|
||
For one-off APIs, use **ocs-api** instead of extending a dedicated node.
|