Skip to main content

FMCAPIClient

Firepower REST API Guides


PyPI - Status PyPI - Format GitHub GitHub release (latest by date) PyPI - Python Version

An API Client for the Cisco Firepower Management Center to be able to easily use the API in a more standard way.

How to install

$ pip install FMCAPIClient

Usage

The argument 'method' must be specify every time.

Note: The class will validate the token, and refresh the token when needed as this validation method is called in between each method call.

NOTE:

Default arguments and attributes

import FMCAPIClient

client = FMCAPIClient.Client(verify=False, warnings=False, api_version='v1')

client.get(url=None, method='', data=None, auth = None)

# client.headers
# client.base_url
# client.token
# client.auth
# client.token_expire
# client.token_refresh
# client.token_refresh_count
# client.domain_uuid
# client.server

Authentication

import FMCAPIClient

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

client.disconnect()

Refresh Token

import FMCAPIClient

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

client.refresh_token_func()

client.disconnect()

The first query

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

response = client.get(method='/devicegroups/devicegrouprecords')
print(json.dumps(response.json(), indent=4))

client.disconnect()

Getting detailed information

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

response = client.get(method=f'/devicegroups/devicegrouprecords', expanded=True)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Filtering

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

group_id = '81fe2042-9ad2-11ea-be78-cde812596ba2'
response = client.get(method=f'/devicegroups/devicegrouprecords/{group_id}')
print(json.dumps(response.json(), indent=4))

client.disconnect()

Paging

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')


response = client.get(method=f'/devicegroups/devicegrouprecords', offset=0, limit=1)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Creating

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

response = client.post(method='/devicegroups/devicegrouprecords', data={'name': 'test_group',
                                                                        'type': 'DeviceGroup'})
print(json.dumps(response.json(), indent=4))

client.disconnect()

Updating

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

group_id = '1234567890abc'
response = client.put(method=f'/devicegroups/devicegrouprecords/{group_id}', data={'id': group_id,
                                                                                   'name': 'test_group_updated',
                                                                                   'type': 'DeviceGroup'})
print(json.dumps(response.json(), indent=4))

client.disconnect()

Deleting

import FMCAPIClient
import json

client = FMCAPIClient.Client()
client.connect(url='https://FMC-server.local', username='admin', password='Admin123')

group_id = '1234567890abc'
response = client.delete(method=f'/devicegroups/devicegrouprecords/{group_id}')
print(json.dumps(response.json(), indent=4))

client.disconnect()

Metadata

Release files for FMCAPIClient 0.0.2

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

Source distribution (sdist)

Source distribution for FMCAPIClient 0.0.2
File Size Uploaded Provenance Actions
FMCAPIClient-0.0.2.tar.gz 5.7 kB Without provenance Details for FMCAPIClient-0.0.2.tar.gz

Release files / FMCAPIClient-0.0.2.tar.gz

Download URL FMCAPIClient-0.0.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
69f32cd3f695865ea4a43aec49fb1187cb7ed6a45dc6d85215122931f607934c
BLAKE2b-256 checksum
How to use checksums
dab86fd271fbcf032e0ba25f3dc18dc8a3dfc5e9797a8983a2055de74488c4a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.8

Security for FMCAPIClient 0.0.2

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.2 This release

1 release file 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