This API requires the basic authentication headers and
uses the GET method. Example 11-13 shows a Python
requests command that uses this API.
Example 11-13 Python Code to Get a List of All
Vulnerabilities via API
Click here to view code image
""" GET list of all vulnerabilities via API
"""
import requests
url =
"https://api.amp.cisco.com/v1/vulnerabilities"
querystring = {"offset":"0","limit":"1"}
headers = {
'authorization': "Basic
ZGVhZGJlZWYxMjM0NDhjY2MwMGQ6WFhYWFhYWFgtWVlZWS1aWlpaL-
TAwMDAtZTM4NGVmMmR4eHh4",
'cache-control': "no-cache",
}
response = requests.request("GET", url,
headers=headers, params=querystring)
print(response.text)
Example 11-14 shows a sample response to the request in
Example 11-13.
Example 11-14 JSON Response Showing
Vulnerabilities
Click here to view code image
{
"version": "v1.2.0",
"metadata": {
"links": {
"self":
"https://api.amp.cisco.com/v1/vulnerabilities?
offset=0&limit=1"
},
"results": {
"total": 1,
"current_item_count": 1,
"index": 0,
"items_per_page": 1
}