Exporting data using phpIPAM API, converting to CSV format and writing to the file
Installing Requirements
-
Python 2
-
CentOS
- yum install -y python2
- pip2 install requests
-
Ubuntu/Debian
- apt-get install -y python2
- pip2 install requests
-
CentOS
-
Python 3
-
CentOS
- yum install -y python3
- pip3 install requests
-
Ubuntu/Debian
- apt-get install -y python3
- pip3 install requests
-
CentOS
User Token In order to make requests without encryption and SSL operations, the following information in the "config.php" file should be as shown:
-
vi /var/www/html/phpipam/config.php
- //$api_crypt_encryption_library = "mcrypt"
- &api_allow_unsafe = true
API service must be opened over the interface and an API key must be created so that the "App security" information will be "User Token". Along with the APP ID information created in the API service, the server address, user name and password must be edited in the script.
Usage
Controller Name | Description |
---|---|
sections | Manages sections part of phpipam |
subnets | Manages Subnets and folder objects |
folders | Folders is alias for subnets controller. |
addresses | Manages IP addresses |
vlans | Manages VLANs |
l2domains | Manages VLAN domains |
vrfs | Manages VRF |
tools | Tools controller (special) |
prefix | Prefix controller (special) |
user/all | Returns all users 1.3 (rwa app permissions required) |
user/admins | Returns admin users 1.3 (rwa app permissions required) |
Examples
-
python2/3 phpIPAM_with_user_token.py controller_name
- python2/3 phpIPAM_with_user_token.py addresses
- python2/3 phpIPAM_with_user_token.py user/all