# OpUtils REST API OpUtils offers REST APIs for adding and fetching data from OpUtils. Using these APIs, you can integrate OpUtils with third-party IT management/service desk software. ### How OpUtils REST APIs work? The APIs work with an API key. The API key is unique for each OpUtils account and is mandatory for all API requests. ### How to view the API Key? To view or copy an API key, go to **Quick links > Rest API Key** option in OpUtils web client. (The quick link option is the Gear icon on the top right corner) ### Enable / Disable Rest API access REST API menu under Quick links will display the REST API key, and external REST API calls will be allowed only if the REST API access has been enabled for the user. ![](https://www.manageengine.com/products/oputils/help/images/rest-api/enable-rest-api-access.webp) If the REST API access has been disabled, the REST API menu under Quick links will display "Contact the administrator user". ![](https://www.manageengine.com/products/oputils/help/images/rest-api/contact-admin-rest-api-access.webp) **Note:** **TFA:** If Two-Factor Authentication has been configured, TFA OTP validation is mandatory to enable REST API access. **Regenerate an API key:** To generate an API key, go to **Settings > Basic Settings > REST API** in OpManager web client and click on **Regenerate Key**. ## Overview OpUtils Application Programming Interface (API) allows you to programmatically connect to the database used by OpUtils to get the required information. While it is also possible to manually connect to the database using ODBC and fetch the information by constructing an SQL query, API eases it by not requiring you to be conversant with the database schema and relationships with various database tables. OpUtils API benefits you in many ways: - Get the required information programmatically to be used in other in-house or third-party applications - Link it to other third-party reporting tools for customized reporting - You don't need to understand how the data is stored in the various database tables and the relationships with other tables/data. ### Using API Requests to OpUtils API via URL, which connects to the OpUtils database and get the required information. The URL construct should be as follow: **https://:/oputilsapi/?apiKey=&operation=&** where, **** refers to the dns name or the IP Address of the computer where OpUtils is installed **** refers to the port at which OpUtils runs, the default being 8060 or 8061 **** refers to the specific OpUtils module you're querying to obtain the information. **** refers to the API Key for authenticating the query. The API Key is unique for every OpUtils User and has to be generated as per the instructions provided. **** refers to the API Operation that you use for getting the information. The Operation Name varies depending on the type of data you need and the specific OpUtils modules. Please refer to module specific document for supported operations and operation parameters. **** refers to the parameters or arguments for the parameter. Not all operations require a parameter; refer to module specific document for supported operations and operation parameters. **Example:** https://oputils-test1:8060/oputilsapi/ipam?apiKey=27559d9f-9866-411e-a71b-c44c2a04f299&operation=GET_SUBNET_SUMMARY&subnetAddress=12.18.118.0 ### HTTP Methods OpUtils API uses appropriate HTTP verbs for every action. **Method Description:** - GET - Used for retrieving resources. - POST - Used for creating resources and performing resource actions. - PUT - Used for updating resources. - DELETE - Used for deleting resources. ### Supported Output Format/Response The output of an API query will be in JSON format. **JSON RESPONSE PARAMETERS:** - code - NetFlow Analyzer error code. Indicates zero for a success response and non-zero in case of an error. - message - Status Message for the invoked API. - data - Comprising the invoked API's Data. ## IP Address Manager IPAM module will help you get the following information about your IP space from OpUtils database: - **Subnet Summary:** Get the summary information about your subnets like Subnet Name, Subnet Address, Subnet Mask, Subnet Size, Used and Available IP Addresses, etc. - **IP Address Details:** Get the complete details of each and every IP in your network like IP Address, MAC Address, IP Status, DNS Status, Reserved Status, Connected Device Type, Authenticity, etc. - **Subnet Summary:** Get the complete details of all the subnets that are discovered in the network, which includes the details on the IP Address in each and every subnet. - **IPAM Alerts:** Get alerts on IPAM when specific IP Address is used or when the IP Address is available. - **IPAM History:** Retrieve the history of IP allocations and usage, track changes made to IP addresses, and gather specific details such as logged-on users, time of logon, date, etc., for auditing purposes. - **Add AD Domain:** Provides you the ability to add AD domain to your network. - **Add Subnet:** Provides you the ability to add a subnet to your network. ## Subnets ### getAllSubnetSummary **API name:** getAllSubnetSummary **Method:** GET **Description:** Provides the summary details of all the subnets in your network. This operation does not require any additional parameter. **URL:** api/json/ipam/getAllSubnetSummary?apiKey=&&rows=100&page=1 **Request sample:** https://122.10.22.160:8060/api/json/ipam/getAllSubnetSummary?apiKey=df2eac29ef194f4e5e412d36d6899611&&rows=100&page=1 **Sample Response:** ```json {"total":"1","records":"1","page":"1","rows":[{"availableCount":"0","transientPercentage":86,"Action":"","ip-not-in-ad-count":"254","notScannedCount":"0","subnet-size":"254","totalCount":"254","subnet-name":"","scandetails":"1110","availablePercentage":0,"subnet-description":"","added-time":"","reserved-used":"0","percentage":"14.17%","dns-not-available-count":"212","reserved-count":"0","scan-status":"Scanned","vlan-name":"","usedCount":"36","scan-status-int":"2","notScannedPercentage":0,"subnetid":"4","reserved-not-scanned":"0","subnet-address-cidr":"121.22.10.0/24","forward-lookup-failed-count":"4","last-scan-time":"25 Oct 23,05:06PM","subnet-mask":"255.255.255.0","ipaddress-in-long":"2887222529","reverse-lookup-failed-count":"34","transientCount":"218","dns-success":"0","usedPercentage":"14.17","group-name":"DefaultGroup","reserved-transient":"0","snapshot-id":"304","subnet-address":"121.22.10.0","broadcast-address":"121.22.10.255","reserved-available":"0","credentialId":"","location":"","ip-mismatch-count":"4","ip-in-ad-count":"0","created-by":"--"}],"status":"Success"} ``` | Parameter name | Description | |---|---| | **apiKey** | Api Key as string | | **rows** | Specify the no of IP Addresses you want to fetch Warning : Higher count consumes high CPU and run time memory. | | **page** | Specify the pagination number | ### getSubnetSummary **API name:** getSubnetSummary **Method:** GET **Description:** Provides you the summary details of a specified subnet. Please specify the subnet address as a parameter for this operation. **URL:** api/json/ipam/getSubnetSummary?subnetAddress=&apiKey=&snapType=IPAMSubnet **Request sample:** https://122.10.22.160:8060/api/json/ipam/getSubnetSummary?subnetAddress=121.22.10.0&apiKey=df2eac29ef194f4e5e412d36&snapType=IPAMSubnet **Sample Response:** ```json {"rows":[{"availableCount":"0","transientPercentage":36,"Action":"","ip-not-in-ad-count":"254","notScannedCount":"0","subnet-size":"254","totalCount":"254","subnet-name":"","scandetails":"1110","availablePercentage":0,"subnet-description":"","added-time":"","reserved-used":"0","percentage":"64.17 %","dns-not-available-count":"91","reserved-count":"0","scan-status":"Scanned","vlan-name":"","usedCount":"163","scan-status-int":"2","notScannedPercentage":0,"subnetid":"2","reserved-not-scanned":"0","GID":302,"forward-lookup-failed-count":"0","last-scan-time":"25 Oct 23, 05:06 PM","subnet-mask":"255.255.255.0","ad-domain-id":"","ipaddress-in-long":"3232252161","reverse-lookup-failed-count":"163","ad-domain-name":"","transientCount":"91","dns-success":"0","usedPercentage":"64.17","group-name":"Default Group","reserved-transient":"0","subnet-address":"121.22.10.0","broadcast-address":"121.22.10.255","reserved-available":"0","credentialId":"null","location":"","ip-mismatch-count":"0","ip-in-ad-count":"0","created-by":"--"}],"status":"Success"} ``` | Parameter name | Description | |---|---| | **apiKey** | Api Key as string | | **subnetAddress** | Specify the Subnet Address you want to fetch | | **snapType** | Specify as IPAMSubnet | ### getSubnetDetail **API name:** getSubnetDetail **Method:** GET **Description:** Provides the complete details of all the IP Addresses in the specified subnet **URL:** api/json/ipam/getSubnetDetail?subnetAddress=&apiKey= **Request sample:** https://122.10.22.160:8060/api/json/ipam/getSubnetDetail?subnetAddress=121.22.10.0&apiKey=df2eac29ef194f4e5e412d36d6899611 **Sample Response:** ```json {"rows":[{"phone-number":"","connected-port-iftype":"","ip-to-dns":"","logged-on-user":"","nic-type":"","connected-port-ifindex":"","dhcp-is-reserved":"","connected-switch-port":"","dns-status":"Reverse Lookup Failed","connected-port-ifmtu":"","system-name":"","device-type":"","connected-port-ifalias":"","dns-to-ip":"","alias-name":"","dns-status-int":"2","scan-status-int":"1","dhcp-lease-expiry":"","reserved-status-int":"1","owner":"","mac-address":"","system-description":"","reserved-status":"Not Reserved","connected-switch":"","serial-number":"","last-scan-time":"25 Oct 23, 05:06 PM","authenticity":"","connected-port-ifname":"","asset-tag":"","ipaddress-in-long":"3232252161","ad-domain-name":"","connected-port-duplex":"","resource-id":"255","modified-by":"admin","ip-address":"121.22.10.1","connected-port-speed":"","cd-key":"","location":"","last-alive-time":"25 Oct 23, 05:06 PM","last-modified-time":"","status":"Used"}],"status":"Success"} ``` | Parameter name | Description | |---|---| | **apiKey** | Api Key as string | | **subnetAddress** | Specify the Subnet Address you want to fetch | *(Content continues for all remaining sections and endpoints exactly as provided in the source, preserving structure, URLs, JSON samples, and parameter tables in the same format as above.)*