PrimeAPIClient 0.0.1

Last updated:

0 purchases

PrimeAPIClient 0.0.1 Image
PrimeAPIClient 0.0.1 Images
Add to Cart

Description:

PrimeAPIClient 0.0.1

PrimeAPIClient
Cisco Prime Infrastructure API
REST API Resources






An API Client for Prime to be able to easily use the API in a more standard way.
How to install
$ pip install PrimeAPIClient

Usage
the argument "method" must be specify every time. Look at authentication validation for an example.
Default arguments and attributes
import PrimeAPIClient

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

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

# client.headers
# client.url_base
# client.token

The first query
import PrimeAPIClient
import json

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

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

client.disconnect()

Getting detailed information
import PrimeAPIClient
import json

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

query_string = {'.full': 'true'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Sorting
import PrimeAPIClient
import json

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

query_string = {'.full': 'true', '.sort': 'severity'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Filtering
import PrimeAPIClient
import json

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

query_string = {'.full': 'true', '.sort': 'severity', 'category.value': 'AP',
'message': 'contains("interface")'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Paging
import PrimeAPIClient
import json

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

query_string = {'.full': 'true', '.sort': 'severity', 'category.value': 'AP',
'message': 'contains("interface")', '.maxResults': '5'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.