Introducing IP Fabric V6
Home
>
Blog
>
How to change settings with API in IP Fabric

How to change settings with API in IP Fabric

3 minute read
Home
>
Blog
>
How to change settings with API in IP Fabric
Updated: October 27, 2023
May 20, 2020
Updated: October 27, 2023
3 mins
apiWebinarPart2PNG

If you ever wonder how to change settings with API in the IP Fabric, then this is the right reading for you. In the previous article, from our API series, we focused on the first steps with IP Fabric's API. It was all about how to authenticate and collect data from inventory.

Today we will take one step further with automation. There are cases where we need to change settings for new network discovery in IP Fabric or start fresh snapshots without interacting with the Graphical User Interface (GUI) by using scripts.

Discovering API endpoints for settings administration

There are multiple endpoints with each specific function in IP Fabric that can help us to change settings with API. In this quick tutorial, we will just mention a few basic ones. The current list of all available endpoints can be found at this site. Let's start with the Seed IP or the starting point for discovery settings.

Modifying the seed IPs

The seed IP address can be a very important part of the discovery process whenever we are about to discover new networks. By default, if there are no discovered devices, the process starts from the default gateway relative from the IP Fabric server. If not reachable the IPF tries to traceroute over the gateway to discover new hops and if there's nothing found from the traceroute, we will need to define at least 1 device as a starting point.

The main endpoint for Seed modification is:

https://IPFserver/api/v1/settings/seed

and the Seed setup has 3 available methods: GET, POST & PUT. The GET request will respond with the list of available IP addresses or subnets in the Seed. The POST request with a payload including a list of additional IPs will add those to the current list. And the PUT request will remove existing data with new IPs int the payload.

Following code snippet may be used to update the Seed information:

def updateSeed(postSeedServer, postSeedHeaders, postSeedLoad):
    seedPost = requests.post(postSeedServer + 'api/v1/settings/seed', headers=postSeedHeaders, json=postSeedLoad, verify=False)
    if seedPost.reason == 'Not Modified': print(' Seed is remaining the same.')
    elif seedPost.ok: print(' Seed updated successfully with: ' + str(postSeedLoad))
    else: print(' UNABLE to update the Seed: ' + seedPost.text)
    return seedPost

Change settings with API in IP Fabric

api icon
Change settings with API

The IP Fabric is an extremely flexible system with plenty of available tweaks related to the Discovery process, SSH connections, or system options, like backups. The API endpoint is:

https://IPFserver/api/v1/settings

The main methods are GET for reading all currently applied settings and PATCH will allow us to change settings with API. The following snippet will collect Settings information and provides a complete JSON format.

def getSettings(getSettServer, getSettHeaders):
    settingsGet = requests.get(getSettServer + 'api/v1/settings', headers=getSettHeaders, verify=False)
    if settingsGet.ok: print(' Following Settings are in use: ' + settingsGet.text)
    else: print(' UNABLE to get Settings info: ' + settingsGet.text)
    return settingsGet

Thank you for reading and now enjoy the second part of our recording!

If you have found this article helpful, please follow our company’s LinkedIn or Blog, where there will be more content emerging. Furthermore, if you would like to test our platform to evaluate how it can assist you in managing your network more effectively, please let us know through www.ipfabric.io.

How to change settings with API in IP Fabric

apiWebinarPart2PNG

If you ever wonder how to change settings with API in the IP Fabric, then this is the right reading for you. In the previous article, from our API series, we focused on the first steps with IP Fabric's API. It was all about how to authenticate and collect data from inventory.

Today we will take one step further with automation. There are cases where we need to change settings for new network discovery in IP Fabric or start fresh snapshots without interacting with the Graphical User Interface (GUI) by using scripts.

Discovering API endpoints for settings administration

There are multiple endpoints with each specific function in IP Fabric that can help us to change settings with API. In this quick tutorial, we will just mention a few basic ones. The current list of all available endpoints can be found at this site. Let's start with the Seed IP or the starting point for discovery settings.

Modifying the seed IPs

The seed IP address can be a very important part of the discovery process whenever we are about to discover new networks. By default, if there are no discovered devices, the process starts from the default gateway relative from the IP Fabric server. If not reachable the IPF tries to traceroute over the gateway to discover new hops and if there's nothing found from the traceroute, we will need to define at least 1 device as a starting point.

The main endpoint for Seed modification is:

https://IPFserver/api/v1/settings/seed

and the Seed setup has 3 available methods: GET, POST & PUT. The GET request will respond with the list of available IP addresses or subnets in the Seed. The POST request with a payload including a list of additional IPs will add those to the current list. And the PUT request will remove existing data with new IPs int the payload.

Following code snippet may be used to update the Seed information:

def updateSeed(postSeedServer, postSeedHeaders, postSeedLoad):
    seedPost = requests.post(postSeedServer + 'api/v1/settings/seed', headers=postSeedHeaders, json=postSeedLoad, verify=False)
    if seedPost.reason == 'Not Modified': print(' Seed is remaining the same.')
    elif seedPost.ok: print(' Seed updated successfully with: ' + str(postSeedLoad))
    else: print(' UNABLE to update the Seed: ' + seedPost.text)
    return seedPost

Change settings with API in IP Fabric

api icon
Change settings with API

The IP Fabric is an extremely flexible system with plenty of available tweaks related to the Discovery process, SSH connections, or system options, like backups. The API endpoint is:

https://IPFserver/api/v1/settings

The main methods are GET for reading all currently applied settings and PATCH will allow us to change settings with API. The following snippet will collect Settings information and provides a complete JSON format.

def getSettings(getSettServer, getSettHeaders):
    settingsGet = requests.get(getSettServer + 'api/v1/settings', headers=getSettHeaders, verify=False)
    if settingsGet.ok: print(' Following Settings are in use: ' + settingsGet.text)
    else: print(' UNABLE to get Settings info: ' + settingsGet.text)
    return settingsGet

Thank you for reading and now enjoy the second part of our recording!

If you have found this article helpful, please follow our company’s LinkedIn or Blog, where there will be more content emerging. Furthermore, if you would like to test our platform to evaluate how it can assist you in managing your network more effectively, please let us know through www.ipfabric.io.

SHARE
Demo

Try out the platform

Test out IP Fabric’s automated network assurance platform yourself and be inspired by the endless possibilities.

What would this change for your network teams?
Start live demo
 
 
 
 
 
We're Hiring!
Join the Team and be part of the Future of Network Automation
Available Positions
IP Fabric, Inc.
115 BROADWAY, 5th Floor
NEW YORK NY, 10006
United States
IP Fabric s.r.o.
Kateřinská 466/40
Praha 2 - Nové Město, 120 00
Czech Republic
This is a block of text. Double-click this text to edit it.
Phone : +420 720 022 997
IP Fabric UK Limited
Gateley Legal, 1 Paternoster Square, London,
England EC4M 7DX
This is a block of text. Double-click this text to edit it.
Phone : +420 720 022 997
IP Fabric, Inc. © 2024 All Rights Reserved