Skip to main content

Python client for Facilio Connections cloud-server /api/v1 Tier 1 API

Project description

Facilio Connections SDK (Python)

Integrator client for Connections /api/v1 using httpx. Concepts: ../README.md. HTTP paths, JSON shapes, headers: ../docs/api-reference.md.

Requirements: Python 3.10+. Import package: facilio_connections_sdk.


Installation

PyPI (when published):

pip install facilio-connections-sdk

Complete walkthrough (code)

Linear script-style example. With the default internal httpx client, call client.close() when finished (or pass your own http_client).

from facilio_connections_sdk import ConnectionsClient

client = ConnectionsClient("https://your-host", "your-service-token")

'''
Using Cookies instead of service token

 cfg = ConnectionsClientConfig(
    base_url="https://connections.facilio.com",
    service_token=None,
    csrf_token="",
    extra_headers={
        "Cookie": "fc.idToken.connections=xxxxxxxx; JSESSIONID=xxxxxx",
    },
    timeout_seconds=120.0,
)

client = ConnectionsClient.from_config(cfg) '''


# list connections
print(client.list_connections())


# get connection name
print(client.get_connection("servicenow-connection").get("connection").get("display_name"))

# get actions for the connection
print(client.list_actions("servicenow-connection"))

# get action inputs for the action
print(client.list_action_inputs("servicenow-connection", "add-comment-in-servicenow-task"))

result = client.connection("servicenow-connection").actions().execute("add-comment-in-servicenow-task", {
    "input": {
        "parentId": "1234567890",
        "body": "This is a test comment",
    }
})

print(result)
if result.get("job_id"):
    client.get_job_result(str(result["job_id"]))

# Same calls via fluent: client.connection("crm-prod").actions().execute("fetch-deal", {...})

client.close()

Request/response JSON uses snake_case. Failures raise ConnectionsApiError (status_code, body).


Method reference

Client construction

Method Purpose
ConnectionsClient(base_url, service_token="") base_url = origin only. Empty token → no X-Service-Token.
ConnectionsClient.from_config(ConnectionsClientConfig, http_client=…) Cookies, org, CSRF, timeouts — see Local development.

Fluent entry points

Method Maps to
client.jobs().result(job_id) GET /jobs/{id}
client.connections().list(relay_id=None, *, authorized=None) GET /connections
client.actions_catalog().list() GET /actions
client.connection(slug) Scope for one connection

Jobs

Method Purpose
get_job_result(job_id) Poll after job_id from async execute.

Connections (flat)

Method Purpose
list_connections(relay_id=None, *, authorized=None) Query relay_id, authorized=true.
get_connection(slug) GET /connections/{slug}.
authorize_connection(slug) POST …/authorize.
unauthorize_connection(slug) POST …/unauthorize.
toggle_connection_active(slug, active) POST …/toggle-active.

Connection scope (client.connection(slug))

Method Purpose
get() Connection metadata.
authorize() / unauthorize() OAuth lifecycle.
set_active(active) Enable/disable connection.
http() _HttpExecutor.
file() _FileExecutor.
sql() _SqlExecutor.
actions() Saved actions on this connection.

Actions — read

Method Purpose
list_all_actions() Org-wide GET /actions.
list_actions(connection_slug) GET …/connections/{slug}/actions.
get_action(connection_slug, action_slug) Single action definition.
list_action_inputs(connection_slug, action_slug) Resolved fields for input.

Fluent: connection(slug).actions().list(), .get(action_slug), .list_inputs(action_slug).

Saved action execute

Method Purpose
execute_action(connection_slug, action_slug, body=None, *, async_=False, timeout_ms=None) body → JSON input / options.

Fluent: connection(slug).actions().execute(action_slug, body, *, async_=False, timeout_ms=None).

Typed HTTP (flat)

execute_http_get|post|patch|put|delete(connection_slug, parameters=None, *, async_=False, timeout_ms=None)parameters: path, query, headers, body.

Fluent: connection(slug).http().get|post|patch|put|delete(parameters, *, async_=False, timeout_ms=None).

Filesystem (flat)

execute_file_read_file, execute_file_upload_file, execute_file_append_file, execute_file_list_files, execute_file_rename_file, execute_file_move_file, execute_file_delete_file — same async_, timeout_ms pattern.

Fluent: connection(slug).file().read|upload|append|list_files|rename|move|delete(...).

SQL (flat)

execute_sql_query, execute_sql_select, execute_sql_insert, execute_sql_update, execute_sql_delete, execute_sql_execute — body keys per api-reference.md.

Fluent: connection(slug).sql().query|select|insert|update|delete|execute(...).


Local development without a service token (cookies + CSRF)

from facilio_connections_sdk import ConnectionsClient, ConnectionsClientConfig

cfg = ConnectionsClientConfig(
    base_url="http://localhost:8081",
    service_token=None,
    org_domain="your-org-domain",
    csrf_token="paste-fc-csrfToken-cookie-value",
    extra_headers={
        "Cookie": "JSESSIONID=...; fc.idToken.connections=...; fc.csrfToken=...; fc.currentOrg=...",
    },
    timeout_seconds=120.0,
)

client = ConnectionsClient.from_config(cfg)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facilio_connections_sdk-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

facilio_connections_sdk-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file facilio_connections_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: facilio_connections_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for facilio_connections_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3af2699958ef6ce7c7d81d1209b3483208992f535551e523500f36d418c5951e
MD5 8b7820949d3e4223a056ca3ccd4b0915
BLAKE2b-256 f523ecd0b6e5f0e468bde2e3c619170cc13b8f99039fb8f49d7acbb392418d52

See more details on using hashes here.

File details

Details for the file facilio_connections_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for facilio_connections_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c62e1b8b0d40b0a54a8bb99171076b708fe5117632229bbf1797f133bd1cfe3d
MD5 d596b483da4d0c5f7f5367818b9ca5f1
BLAKE2b-256 38deedf003802bf40a13475850655c2575fc2756cf610585aa508c9398650fad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page