Skip to main content

NCM API Client Documentation

Overview

This module provides easy access to the Cradlepoint NCM API with support for both v2 and v3 APIs. It includes a singleton pattern for simple usage and module-level function access for convenience.

Installation

pip install -U ncm

Requirements

Cradlepoint NCM API Keys are required to make API calls:

  • For v2 API: X-CP-API-ID, X-CP-API-KEY, X-ECM-API-ID, X-ECM-API-KEY
  • For v3 API: Bearer token

Usage Options

import ncm

# Set these environment variables once:
# export X_CP_API_ID="b89a24a3"
# export X_CP_API_KEY="4b1d77fe271241b1cfafab993ef0891d"
# export X_ECM_API_ID="c71b3e68-33f5-4e69-9853-14989700f204"
# export X_ECM_API_KEY="f1ca6cd41f326c00e23322795c063068274caa30"
# export NCM_API_TOKEN="your-bearer-token"  # For v3 API

# Then just use it - no setup required!
accounts = ncm.get_accounts()
devices = ncm.get_devices()
routers = ncm.get_routers()

2. Explicit Configuration (Alternative)

import ncm

# Option A: Set up API keys explicitly
api_keys = {
   'X-CP-API-ID': 'b89a24a3',
   'X-CP-API-KEY': '4b1d77fe271241b1cfafab993ef0891d',
   'X-ECM-API-ID': 'c71b3e68-33f5-4e69-9853-14989700f204',
   'X-ECM-API-KEY': 'f1ca6cd41f326c00e23322795c063068274caa30'
}
ncm.set_api_keys(api_keys)

# Option B: Manual environment variable loading
ncm.set_api_keys()  # Manually loads from environment

3. Traditional Class Instantiation

import ncm
api_keys = {...}  # Same as above
client = ncm.NcmClient(api_keys=api_keys)
accounts = client.get_accounts()

4. Mixed v2/v3 API Usage

import ncm
api_keys = {
   'X-CP-API-ID': 'b89a24a3',
   'X-CP-API-KEY': '4b1d77fe271241b1cfafab993ef0891d',
   'X-ECM-API-ID': 'c71b3e68-33f5-4e69-9853-14989700f204',
   'X-ECM-API-KEY': 'f1ca6cd41f326c00e23322795c063068274caa30',
   'token': 'your-v3-bearer-token'  # For v3 API
}
client = ncm.NcmClient(api_keys=api_keys)
# Methods will automatically route to the appropriate API version

5. Backward Compatibility (Legacy Scripts)

from ncm import ncm  # Old import pattern still works!

api_keys = {
    'X-ECM-API-ID': os.environ.get("X_ECM_API_ID"),
    'X-ECM-API-KEY': os.environ.get("X_ECM_API_KEY"),
    'X-CP-API-ID': os.environ.get("X_CP_API_ID"),
    'X-CP-API-KEY': os.environ.get("X_CP_API_KEY"),
    'Authorization': f'Bearer {os.environ.get("TOKEN")}'
}

# All existing patterns work unchanged:
ncm_client = ncm.NcmClientv3(api_key=token, log_events=True)
ncm_client.set_api_keys(api_keys)  # Instance method still works

# New convenience pattern also available:
ncm.set_api_keys(api_keys)  # Module-level method
routers = ncm.get_routers()  # Direct method access

Features

  • ✅ Zero-configuration usage with automatic environment variable loading
  • ✅ Singleton pattern for easy module-level access
  • ✅ Automatic API version routing (v3 prioritized over v2)
  • ✅ Module-level function access (ncm.method_name())
  • ✅ Automatic initialization on import if environment variables are set
  • ✅ Full backward compatibility with existing scripts
  • ✅ Support for both import patterns: "import ncm" and "from ncm import ncm"
  • ✅ Optimized pagination (default limit 500 vs API default 20)
  • ✅ Support for limit='all' to get all records without paging
  • ✅ Automatic chunking of "__in" filters beyond 100 item limit

Documentation

Full documentation of the Cradlepoint NCM API is available at: https://developer.cradlepoint.com

Metadata

Release files for ncm 0.0.71

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ncm 0.0.71
File Size Uploaded Provenance Actions
ncm-0.0.71.tar.gz 34.6 kB Without provenance Details for ncm-0.0.71.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ncm 0.0.71
File Interpreter ABI Platform Actions
ncm-0.0.71-py3-none-any.whl Python 3 none any Details for ncm-0.0.71-py3-none-any.whl

Total release size: 69.5 kB

Release files / ncm-0.0.71.tar.gz

Download URL ncm-0.0.71.tar.gz
Size 34.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b955a7840527e44b70596ecc7893671182134f2cd21bd3d9b76d2b623e72f1da
BLAKE2b-256 checksum
How to use checksums
a4d090d2780f2317db3e9d9d1429a98d330147d43b2eb209d587e05f5bb14661
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / ncm-0.0.71-py3-none-any.whl

Download URL ncm-0.0.71-py3-none-any.whl
Size 34.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a9d6d7f30888651ee41a23f975511f9503c26b8b822cffa91e7a67abc5227a1
BLAKE2b-256 checksum
How to use checksums
21d8e69abeebdf1676077cdb566eebc032812d18d2b3012a9a98c18c7ccf9569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for ncm 0.0.71

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.71 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page