Skip to content

ronier83/ctera-n8n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CTERA n8n App

Use CTERA Portal from n8n: log in, check session, list tenants, list devices, and run other Admin API actions from your workflows.

This repo is the CTERA n8n app that customers add to n8n (via GitHub / npm). It provides:

  • CTERA node — An n8n community node with a dropdown of Admin API actions (Current session, List tenants, List filers, etc.).
  • App service — A small API used by the node for login and Portal calls (you run it yourself or host it).
  • Example workflows — CTERA login and usage examples.

Add the app to n8n (from this repo / GitHub)

Option 1: Install from npm (recommended)

After this app is published to npm from this repo:

  1. In n8n: SettingsCommunity nodesInstall.
  2. Enter the package name (e.g. n8n-nodes-ctera or @your-org/n8n-nodes-ctera).
  3. Restart n8n if prompted. Search for CTERA when adding a node.

Option 2: Use from GitHub (clone and build)

  1. Clone this repo:
    git clone https://github.com/ronier83/ctera-n8n.git
    cd ctera-n8n
  2. Build and run n8n with the CTERA node loaded:
    cd n8n-nodes-ctera && npm install && npm run build && npx @n8n/node-cli dev
  3. Open http://localhost:5678 and search for CTERA when adding a node.

Option 3: Add to n8n running in Docker

If the app is published to npm (e.g. n8n-nodes-ctera):

  1. Using the n8n UI (easiest)
    Open your n8n (e.g. http://localhost:5678) → SettingsCommunity nodesInstall → enter n8n-nodes-ctera → Install. Restart the container if n8n asks.

  2. Persist custom nodes so they survive container restarts. Run Docker with a volume for n8n’s data (including community nodes):

    docker run -it --rm --name n8n -p 5678:5678 \
      -v n8n_data:/home/node/.n8n \
      n8nio/n8n

    After you install the CTERA app from the UI, it lives under ~/.n8n/nodes and is kept by the volume.

If the app is not on npm yet (install from your local build):

  1. Build and pack the node (on your machine):

    cd ctera-n8n/n8n-nodes-ctera
    npm install && npm run build
    npm pack

    This creates n8n-nodes-ctera-1.0.0.tgz (or similar).

  2. Copy the tarball into the running n8n container and install it inside the container:

    docker cp n8n-nodes-ctera-1.0.0.tgz n8n:/tmp/
    docker exec -it n8n sh -c "mkdir -p /home/node/.n8n/nodes && cd /home/node/.n8n/nodes && npm install /tmp/n8n-nodes-ctera-1.0.0.tgz"
  3. Restart the n8n container so it loads the new node. Use a volume for /home/node/.n8n (as above) so the install is kept after restart.

Then open n8n and search for CTERA when adding a node.


Quick start (after the node is installed)

  1. Run the app service (required for the CTERA node to call your Portal):

    cd services/ctera-portal && npm install && npm run build
    cd ../app && npm install && npm run build && npm start

    Default: http://localhost:3000. If n8n runs in Docker, use http://host.docker.internal:3000 in credentials.

  2. Create a CTERA App API credential — App Service URL (e.g. http://localhost:3000 or http://host.docker.internal:3000), Host, Context, Username, Password; enable “Allow self-signed” if needed. You can leave Session Cookie empty when using the CTERA node chain below.

  3. Run a workflow — Either:

    • workflows/02-ctera-login.json — HTTP-based login (Manual Trigger → Set → HTTP Request). Use this to get a cookie to paste into the credential if you prefer cookie-based runs.
    • workflows/04-ctera-node-login-set-portal-list-users.json — Full CTERA node chain: CTERA (Login)CTERA (Set portal context)CTERA (List users). Import it, assign the CTERA App API credential to each CTERA node, then run. The node passes the session cookie from Login to the next nodes automatically.
    • workflows/06-ctera-metadata-list-longpoll-loop.jsonMetadata list → longpoll → loop: optional folder_ids and cursor; when longpoll returns, calls list again with the new cursor in an endless loop. First run uses Manual Trigger (Login → List → Longpoll → Loop again). After importing, open the Loop again node and set it to run this workflow so the loop works.

What’s in this repo

Path Purpose
n8n-nodes-ctera/ n8n community node (the CTERA “Action in an app”). Install this in n8n.
services/ App service + CTERA Portal client. Run the app so the node can log in and call the Portal.
workflows/ Example CTERA workflows: HTTP login (02); HTTP login → set portal → list users (03); CTERA node Login → Set portal → List users → List domain users (04); CTERA node List all devices (05); CTERA Metadata list-longpoll loop (06). Import into n8n.

Requirements

  • Node.js 18+ (for the app service and for building the node).
  • n8n (Docker or local).
  • CTERA Portal (Admin or Services Portal) reachable from where the app service runs.

Portal XML: pretty-print and convert to JSON

When you call the Portal API directly (e.g. with curl) or inspect raw responses, the XML can be hard to read. The CTERA node and app already return clean JSON for list actions (users, portals, devices, etc.), so you usually don’t need to handle XML in workflows. These tips help when you work with raw Portal XML outside n8n.

  • Pretty-print XML — Pipe the response through xmllint --format - (macOS/Linux), or use a small Python script with xml.dom.minidom.parseString(raw).toprettyxml(indent=" ").
  • Convert any XML to JSON — Use a generic converter (e.g. Python with xml.etree.ElementTree: walk the tree and build a dict/list structure, then json.dumps(..., indent=2)). Handy for one-off inspection.
  • CTERA SDK format — If the response matches the CTERA SDK XML schema, you can parse it with the SDK (e.g. Python: from cterasdk import fromxmlstr, tojsonstr) and print clean JSON.

License

MIT.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors