How to get a list of devices using the API and Python.

Userlevel 3

The same data that can be found in the Forward Enterprise GUI can also be accessed via the API. Here is an example to pull a JSON formatted list of all the devices in a Network using the API and Python.

Start by generating an API key from Settings > Account API Tokens. You will have to re-enter your password. Write down the API password. It will not be shown again! 


Go to the API docs ( If you have an on-prem deployment of Forward Networks, the domain name in the URL will be specific to your company. Enter the API Access Key and Secret Key that you created.

Go to the Network Devices section of the same page (

Click Try it out. Note that this button will only work if you have already entered your API credentials.


Enter the Network ID that you want to pull a list of devices from. (This is the number in the URL when you are in the App on the search tab:

Click Execute.


This will generate the Curl command that you can use in a script including the Request URL, as well as provide the actual JSON output for the command. The “name” field in the JSON snippet above are the names of the devices. The data is from the most recent snapshot of the Network ID provided.

Using the Request URL and auth string provided above, the Python code below would get the same JSON ouput.

import http.client

conn = http.client.HTTPSConnection("")

headersList = {
"Accept": "*/*",
"User-Agent": "Thunder Client (",
"Authorization": "Basic **redacted**"

payload = ""

conn.request("GET", "/api/networks/12346/devices?skip=0", payload, headersList)
response = conn.getresponse()
result =



0 replies

Be the first to reply!