Figure 11-5 Firepower Allowing Both Northbound
and Southbound APIs
Authentication
The Firepower APIs are already part of the FMC software
by default, and the only thing that is required is to enable
them via the UI. The Firepower APIs use token-based
authentication for API users. Consider the simple
example shown in Example 11-9. It uses the Python
requests command to make the REST call, the POST
method, and the API
https://fmcrestapisandbox.cisco.com/api/fmc_platform
/v1/auth/generatetoken.
Example 11-9 Python Code to Generate the Session
Token for Firepower Management Center
Click here to view code image
""" Generate the session token for FMC """
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
url =
"https://fmcrestapisandbox.cisco.com/api/fmc_platform/v1/auth/generatetoken"
headers = {
'Content-Type': "application/xml",
'Authorization': "Basic
YXNodXRvc2g6V0JVdkE5TXk=",
}
response = requests.request("POST", url,
headers=headers)
print(response.headers)
The response header contains 'X-auth-access-token':
"03d91b3f-eeff-4056-a4a7-e121ddcf8910", which
needs to be used in all subsequent API calls.
System Information