WHOIS REST API Lookup

Ed Shryane edited this page May 22, 2017 · 38 revisions

Returns an object from the RIPE Database.

Additional resources:

  • [Version list](WHOIS REST API Versions)
  • [Version lookup](WHOIS REST API Version)

Locations

  • http://rest.db.ripe.net
  • https://rest.db.ripe.net
  • http://rest-test.db.ripe.net
  • https://rest-test.db.ripe.net

Method: GET

URI Format: /{source}/{objectType}/{key}

Path Parameters

name description
source Source name (RIPE, TEST or a GRS source name).
objectType Type of given object.
key Primary key of the given object.

Query Parameters

name description
unfiltered The returned object should not be filtered ("notify" and "e-mail" attributes will not be removed).
unformatted Return the resource in its original formatting (including spaces, end-of-lines) .

HTTP Response Body

A WhoisResource containing the object, which is filtered by default.

HTTP status Codes

code description
200 Object found for the specified key
400 Bad request
404 The query didn't return any valid object

Examples

Example request:

curl 'http://rest.db.ripe.net/ripe/mntner/RIPE-DBM-MNT'

Example XML response:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<whois-resources service="lookup" xmlns:xlink="http://www.w3.org/1999/xlink">
    <objects>
        <object type="mntner">
            <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/ripe/mntner/RIPE-DBM-MNT"/>
            <source id="ripe"/>
            <primary-key>
                <attribute name="mntner" value="RIPE-DBM-MNT"/>
            </primary-key>
            <attributes>
                <attribute name="mntner" value="RIPE-DBM-MNT"/>
                <attribute name="descr" value="Mntner for RIPE DBM objects."/>
                <attribute name="admin-c" value="RD132-RIPE" referenced-type="role">
                    <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/ripe/role/RD132-RIPE"/>
                </attribute>
                <attribute name="tech-c" value="RD132-RIPE" referenced-type="role">
                    <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/ripe/role/RD132-RIPE"/>
                </attribute>
                <attribute name="org" value="ORG-NCC1-RIPE" referenced-type="organisation">
                    <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/lookup/ripe/organisation/ORG-NCC1-RIPE"/>
                </attribute>
                <attribute name="auth" value="PGPKEY-1290F9D2" referenced-type="key-cert">
                    <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/ripe/key-cert/PGPKEY-1290F9D2"/>
                </attribute>
                <attribute name="auth" value="MD5-PW" comment="Filtered"/>
                <attribute name="mnt-by" value="RIPE-DBM-MNT" referenced-type="mntner">
                    <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/ripe/mntner/RIPE-DBM-MNT"/>
                </attribute>
                <attribute name="source" value="RIPE" comment="Filtered"/>
            </attributes>
        </object>
    </objects>
    <terms-and-conditions xlink:type="locator" xlink:href="http://www.ripe.net/db/support/db-terms-conditions.pdf"/>
</whois-resources>

Example JSON request:

curl -H 'Accept: application/json' 'http://rest.db.ripe.net/ripe/mntner/RIPE-DBM-MNT'

Example JSON response:

{
  "objects": {
    "object": [
      {
        "type": "mntner",
        "link": {
          "xlink:type": "locator",
          "xlink:href": "http://rest.db.ripe.net/ripe/mntner/RIPE-DBM-MNT"
        },
        "source": {
          "id": "ripe"
        },
        "primary-key": {
          "attribute": [
            {
              "name": "mntner",
              "value": "RIPE-DBM-MNT"
            }
          ]
        },
        "attributes": {
          "attribute": [
            {
              "name": "mntner",
              "value": "RIPE-DBM-MNT"
            },
            {
              "name": "descr",
              "value": "Mntner for RIPE DBM objects."
            },
            {
              "link": {
                "xlink:type": "locator",
                "xlink:href": "http://rest.db.ripe.net/ripe/role/RD132-RIPE"
              },
              "name": "admin-c",
              "value": "RD132-RIPE",
              "referenced-type": "role"
            },
            {
              "link": {
                "xlink:type": "locator",
                "xlink:href": "http://rest.db.ripe.net/ripe/role/RD132-RIPE"
              },
              "name": "tech-c",
              "value": "RD132-RIPE",
              "referenced-type": "role"
            },
            {
              "link": {
                "xlink:type": "locator",
                "xlink:href": "http://rest.db.ripe.net/ripe/organisation/ORG-NCC1-RIPE"
              },
              "name": "organisation",
              "value": "ORG-NCC1-RIPE",
              "referenced-type": "organisation"
            },
            {
              "link": {
                "xlink:type": "locator",
                "xlink:href": "http://rest.db.ripe.net/ripe/key-cert/PGPKEY-1290F9D2"
              },
              "name": "auth",
              "value": "PGPKEY-1290F9D2",
              "referenced-type": "key-cert"
            },
            {
              "name": "auth",
              "value": "MD5-PW",
              "comment": "Filtered"
            },
            {
              "link": {
                "xlink:type": "locator",
                "xlink:href": "http://rest.db.ripe.net/ripe/mntner/OWNER-MNT"
              },
              "name": "mnt-by",
              "value": "RIPE-DBM-MNT",
              "referenced-type": "mntner"
            },
            {
              "name": "source",
              "value": "RIPE",
              "comment": "Filtered"
            }
          ]
        }
      }
    ]
  }, 
  "terms-and-conditions": {
     "xlink:type": "locator",
     "xlink:href": "http://www.ripe.net/db/support/db-terms-conditions.pdf"
  }
}

Example unfiltered request:

curl 'http://rest-test.db.ripe.net/test/person/AA1-TEST?unfiltered'

Example unfiltered response:

<?xml version="1.0" ?>
<whois-resources xmlns:xlink="http://www.w3.org/1999/xlink">
    <objects>
        <object xmlns="" type="person">
            <link xlink:type="locator" xlink:href="http://rest-test.db.ripe.net/test/person/AA1-TEST"></link>
            <source id="test"/>
            <primary-key>
                <attribute name="nic-hdl" value="AA1-TEST"></attribute>
            </primary-key>
            <attributes>
                <attribute name="person" value="Test Person"></attribute>
                <attribute name="mnt-by" value="TEST-ROOT-MNT" referenced-type="mntner">
                    <link xlink:type="locator" xlink:href="http://rest-test.db.ripe.net/test/mntner/TEST-ROOT-MNT"></link>
                </attribute>
                <attribute name="address" value="Somewhere in nowhere"></attribute>
                <attribute name="phone" value="+12 34 5678900"></attribute>
                <attribute name="fax-no" value="+12 34 5678900"></attribute>
                <attribute name="e-mail" value="bitbucket@ripe.net"></attribute>
                <attribute name="nic-hdl" value="AA1-TEST"></attribute>
                <attribute name="remarks" value="This is an automatically created object."></attribute>
                <attribute name="source" value="TEST"></attribute>
            </attributes>
            <tags></tags>
        </object>
    </objects>
    <terms-and-conditions xlink:type="locator" xlink:href="http://www.ripe.net/db/support/db-terms-conditions.pdf"/>
</whois-resources>

Example bad request when source is incorrect:

curl 'http://rest.db.ripe.net/pez/person/PP1-RIPE'

Example response for bad request:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<whois-resources xmlns:xlink="http://www.w3.org/1999/xlink">
    <link xlink:type="locator" xlink:href="http://rest.db.ripe.net/pez/person/PP1-RIPE"/>
    <errormessages>
        <errormessage severity="Error" text="Invalid source '%s'">
            <args value="pez"/>
        </errormessage>
    </errormessages>
    <terms-and-conditions xlink:type="locator" xlink:href="http://www.ripe.net/db/support/db-terms-conditions.pdf"/>
</whois-resources>

Example request with encoded query parameter:

curl 'http://rest.db.ripe.net/ripe/inetnum/193.0.0.0%20-%20193.0.7.255.json'