cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
298
Views
0
Helpful
0
Replies

Firepower running ASA code using the FXOS API

NazgulNr5
Beginner
Beginner

Hi there,

we have some Firepower 2130 that are running ASA code but in platform mode. To back up the interface config from the FXOS I'd like to use the FXOS REST API through a Python script.

However, when I try to log in and obtain a session token I always get error 400 (bad request).

Any ideas why it's not working?

Here's my code snipped:

def api_call(ip_addr, port, command, json_payload, sid):
    url = 'https://' + ip_addr + ":" + str(port) + '/api/' + command
    if sid == '':
        request_headers = {'Content-Type' : 'application/json'}
    else:
        request_headers = {'Content-Type' : 'application/json', 'X-chkp-sid' : sid}
    r = requests.post(url,data=json.dumps(json_payload), headers=request_headers, verify=False)
    return r


def login(user, password):
    payload = {'username': user,
               'password': password}
    command = "/api/login"
    response = api_call(fp_ip, 443, command, payload, '')
    return response


r = login(fxos_username, fxos_password)
print(r)

 

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers