FabrikFabrik
FabrikAPI Reference

APIC connections

Manage the Cisco APIC controllers Fabrik queries against. Credentials are Fernet-encrypted at rest.

All endpoints under /api/apic/connections/. A single ViewSet exposes list, CRUD, and a test_connection action.

Resource shape

{
  "id": "a3e1f…",
  "name": "Production APIC",
  "host": "apic.example.com",
  "username": "admin",
  "verify_ssl": true,
  "is_default": false,
  "last_tested_at": "2026-04-22T08:00:00Z",
  "last_test_status": "success",
  "last_test_message": "Authenticated as admin. APIC version 6.0(8e).",
  "created_at": "2026-01-15T09:00:00Z",
  "updated_at": "2026-04-22T08:00:00Z"
}

The password is write-only — it's Fernet-encrypted in the database (ENCRYPTION_KEY) and never returned. To change the password, send it again on a PATCH.

Endpoints

GET /api/apic/connections/

Paginated list of connections visible to the user.

Query params:

  • ?search=<term> — matches name and host.
  • ?is_default=true — only the default connection (at most one).

POST /api/apic/connections/

Create a connection.

Request:

{
  "name": "Production APIC",
  "host": "apic.example.com",
  "username": "admin",
  "password": "••••••••",
  "verify_ssl": true,
  "is_default": false
}

Response 201: Full resource shape (without password).

verify_ssl: false disables certificate validation for this connection — acceptable for lab APICs with self-signed certs, never for production. The backend logs a warning every time an unverified connection is used.

GET /api/apic/connections/<id>/

Single connection detail.

PATCH /api/apic/connections/<id>/

Update any field. Sending password replaces the stored credential; omitting it leaves the existing one intact.

DELETE /api/apic/connections/<id>/

Delete a connection. Any saved query or scheduled task pointing at it fails on next execution with a clear error — the frontend surfaces an orphaned-connection warning.

POST /api/apic/connections/<id>/test_connection/

Live test. Opens a session against the APIC, authenticates, and fetches the version banner.

Response 200:

{
  "status": "success",
  "message": "Authenticated as admin. APIC version 6.0(8e).",
  "tested_at": "2026-04-22T08:00:00Z"
}

Response 200 (failure):

{
  "status": "failure",
  "message": "HTTP 401 — authentication failed",
  "tested_at": "2026-04-22T08:00:00Z"
}

The action always returns 200 — the status field tells you whether it worked. That keeps the frontend from having to distinguish HTTP errors from validation failures.

POST /api/apic/connections/<id>/set_default/

Promote this connection to the user's default. The prior default is demoted automatically.

Filters and ordering

  • ?ordering=-last_tested_at — most recently tested first.
  • ?ordering=name — alphabetical.