Question

Regexp in RESTAPI

  • 27 May 2024
  • 1 reply
  • 32 views

Hello team,

 

Is possible search in oneIPTable database by string ? In whole database ? Or use regular expression ?

 

Problem is that when I open it via GUI a try search it goes via every field in database and is searching string as I type it to search. But when I want do it via REST API I can only go through  rows with one Key IP, old DNS, MAC et. But o want to go through whole database and find every device that contains in hostname  for example backbone.


1 reply

Hi Lorenso,

 

Unfortunately, there isn't a direct way to search with a semi-string using an API call to the One-IP Table.

However, if you are using a Python script that takes input from the user, you can achieve this by following these steps:

  1. Make an API call without specifying the IP Address, but include the beginIndex and Count parameters. The maximum allowed Count is 10,000.
  2. If you have more than 10,000 IPs, loop through the results by incrementing the beginIndex value by 10,000 in each iteration while keeping the Count constant.
  3. This will allow you to retrieve the full One-IP Table.
  4. Once you have the data, use your regex to search for multiple switches with a common string (example .*backbone.*).

By doing this, you can get the required output effectively.

 

Thanks,

Pramod.

Reply


Community |  Ideas

Facebook |  Instagram |  Youtube |  Twitter |  LinkedIn
Privacy & Security Statement  |  Terms & Conditions |  Impressum  |  UK Modern Slavery Statement