Mandeep Singh
Mandeep Singh

Reputation: 8224

RIPE: How to lookup IP Address using REST API

As per the RIPE REST API documentation, one needs to specify the requests in the following format:

http://rest.db.ripe.net/{source}/{objecttype}/{key}

So I am assuming that looking up an IP address will be like this:

http://rest.db.ripe.net/ripe/inetnum/193.0.6.142.json

However, the response I get is :

{
  "link": {
    "type": "locator",
    "href": "http://rest.db.ripe.net/ripe/inetnum/193.0.6.142"
  },
  "errormessages": {
    "errormessage": [
      {
        "severity": "Error",
        "text": "ERROR:101: no entries found\n\nNo entries found in source %s.\n",
        "args": [
          {
            "value": "RIPE"
          }
        ]
      }
    ]
  },
  "terms-and-conditions": {
    "type": "locator",
    "href": "http://www.ripe.net/db/support/db-terms-conditions.pdf"
  }
}

What am I doing wrong ?

Upvotes: 4

Views: 7838

Answers (3)

Andrey M.
Andrey M.

Reputation: 11

You didn't write {key} part right. Inetnum objects on RIPE have "193.0.0.0 - 193.0.7.255" type of key. You must make a request like this:

https://rest.db.ripe.net/ripe/inetnum/91.123.16.0 - 91.123.31.255

Upvotes: 1

Baldrick
Baldrick

Reputation: 11002

You are using the wrong URL, the correct URL for your example query would be:

http://rest.db.ripe.net/search.json?query-string=193.0.0.0/21&flags=no-filtering

Or this for XML:

http://rest.db.ripe.net/search.xml?query-string=193.0.0.0/21&flags=no-filtering

Upvotes: 7

Chris
Chris

Reputation: 4728

Looks like https://rest.db.ripe.net/search.json?query-string=193.0.6.142 is the correct link to use. This seems to return back the same data as I see on ripe.net

Upvotes: 2

Related Questions