Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.0.0+

RDAP Domain Lookup using rdap.org

See more HTTP Misc Examples

Demonstrates doing an RDAP domain lookup using the rdap.org public RDAP server.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example requires the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final http = CkHttp();

  // Send HTTP requests to https://rdap.org/<type>/<object>, where <type> is the object type (one of domain, ip, autnum, entity etc)
  // and <object> is the object identifier (eg example.com, 192.168.0.1, 64496, etc).

  // For example, here's a lookup for "oracle.com"
  final sbResponse = CkStringBuilder();
  try {
    http.quickGetSb('https://rdap.org/domain/oracle.com', sbResponse);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  final statusCode = http.lastStatus;
  if (statusCode != 200) {
    print('Error response:');
    print(sbResponse.getAsString());
    print('status code: $statusCode');
    return;
  }

  // Load the JSON response and examine..

  // Use this online tool to generate parsing code from sample JSON: 
  // Generate Parsing Code from JSON

  final json = CkJsonObject();
  json.loadSb(sbResponse);
  json.emitCompact = false;
  print(json.emit());

  // Here's a sample response, and the parsing code generated from the above online tool follows..

  // {
  //   "objectClassName": "domain",
  //   "handle": "607513_DOMAIN_COM-VRSN",
  //   "ldhName": "ORACLE.COM",
  //   "links": [
  //     {
  //       "value": "https:\/\/rdap.verisign.com\/com\/v1\/domain\/ORACLE.COM",
  //       "rel": "self",
  //       "href": "https:\/\/rdap.verisign.com\/com\/v1\/domain\/ORACLE.COM",
  //       "type": "application\/rdap+json"
  //     },
  //     {
  //       "value": "https:\/\/rdap.markmonitor.com\/rdap\/domain\/ORACLE.COM",
  //       "rel": "related",
  //       "href": "https:\/\/rdap.markmonitor.com\/rdap\/domain\/ORACLE.COM",
  //       "type": "application\/rdap+json"
  //     }
  //   ],
  //   "status": [
  //     "client delete prohibited",
  //     "client transfer prohibited",
  //     "client update prohibited",
  //     "server delete prohibited",
  //     "server transfer prohibited",
  //     "server update prohibited"
  //   ],
  //   "entities": [
  //     {
  //       "objectClassName": "entity",
  //       "handle": "292",
  //       "roles": [
  //         "registrar"
  //       ],
  //       "publicIds": [
  //         {
  //           "type": "IANA Registrar ID",
  //           "identifier": "292"
  //         }
  //       ],
  //       "vcardArray": [
  //         "vcard",
  //         [
  //           [
  //             "version",
  //             {},
  //             "text",
  //             "4.0"
  //           ],
  //           [
  //             "fn",
  //             {},
  //             "text",
  //             "MarkMonitor Inc."
  //           ]
  //         ]
  //       ],
  //       "entities": [
  //         {
  //           "objectClassName": "entity",
  //           "roles": [
  //             "abuse"
  //           ],
  //           "vcardArray": [
  //             "vcard",
  //             [
  //               [
  //                 "version",
  //                 {},
  //                 "text",
  //                 "4.0"
  //               ],
  //               [
  //                 "fn",
  //                 {},
  //                 "text",
  //                 ""
  //               ],
  //               [
  //                 "tel",
  //                 {
  //                   "type": "voice"
  //                 },
  //                 "uri",
  //                 "tel:+1.2086851750"
  //               ],
  //               [
  //                 "email",
  //                 {},
  //                 "text",
  //                 "abusecomplaints@markmonitor.com"
  //               ]
  //             ]
  //           ]
  //         }
  //       ]
  //     }
  //   ],
  //   "events": [
  //     {
  //       "eventAction": "registration",
  //       "eventDate": "1988-12-02T05:00:00Z"
  //     },
  //     {
  //       "eventAction": "expiration",
  //       "eventDate": "2025-12-01T05:00:00Z"
  //     },
  //     {
  //       "eventAction": "last changed",
  //       "eventDate": "2024-10-30T09:32:52Z"
  //     },
  //     {
  //       "eventAction": "last update of RDAP database",
  //       "eventDate": "2024-11-26T14:11:14Z"
  //     }
  //   ],
  //   "secureDNS": {
  //     "delegationSigned": false
  //   },
  //   "nameservers": [
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "A1-160.AKAM.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "A11-66.AKAM.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "A13-65.AKAM.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "A18-67.AKAM.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "NS1.P201.DNS.ORACLECLOUD.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "NS2.P201.DNS.ORACLECLOUD.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "NS3.P201.DNS.ORACLECLOUD.NET"
  //     },
  //     {
  //       "objectClassName": "nameserver",
  //       "ldhName": "NS4.P201.DNS.ORACLECLOUD.NET"
  //     }
  //   ],
  //   "rdapConformance": [
  //     "rdap_level_0",
  //     "icann_rdap_technical_implementation_guide_0",
  //     "icann_rdap_response_profile_0"
  //   ],
  //   "notices": [
  //     {
  //       "title": "Terms of Use",
  //       "description": [
  //         "Service subject to Terms of Use."
  //       ],
  //       "links": [
  //         {
  //           "href": "https:\/\/www.verisign.com\/domain-names\/registration-data-access-protocol\/terms-service\/index.xhtml",
  //           "type": "text\/html"
  //         }
  //       ]
  //     },
  //     {
  //       "title": "Status Codes",
  //       "description": [
  //         "For more information on domain status codes, please visit https:\/\/icann.org\/epp"
  //       ],
  //       "links": [
  //         {
  //           "href": "https:\/\/icann.org\/epp",
  //           "type": "text\/html"
  //         }
  //       ]
  //     },
  //     {
  //       "title": "RDDS Inaccuracy Complaint Form",
  //       "description": [
  //         "URL of the ICANN RDDS Inaccuracy Complaint Form: https:\/\/icann.org\/wicf"
  //       ],
  //       "links": [
  //         {
  //           "href": "https:\/\/icann.org\/wicf",
  //           "type": "text\/html"
  //         }
  //       ]
  //     }
  //   ]
  // }

  var value = '';
  var rel = '';
  var href = '';
  var vType = '';
  var strVal = '';
  var j = 0;
  var countJ = 0;
  var identifier = '';
  var k = 0;
  var countK = 0;
  final json1 = CkJsonObject();
  var i1 = 0;
  var countI1 = 0;
  var j1 = 0;
  var countJ1 = 0;
  var eventAction = '';
  var eventDate = '';
  var title = '';

  var objectClassName = json.stringOf('objectClassName');
  var handle = json.stringOf('handle');
  var ldhName = json.stringOf('ldhName');
  var i = 0;
  var countI = json.sizeOfArray('links');
  while (i < countI) {
    json.i = i;
    value = json.stringOf('links[i].value');
    rel = json.stringOf('links[i].rel');
    href = json.stringOf('links[i].href');
    vType = json.stringOf('links[i].type');
    i++;
  }

  i = 0;
  countI = json.sizeOfArray('status');
  while (i < countI) {
    json.i = i;
    strVal = json.stringOf('status[i]');
    i++;
  }

  i = 0;
  countI = json.sizeOfArray('entities');
  while (i < countI) {
    json.i = i;
    objectClassName = json.stringOf('entities[i].objectClassName');
    handle = json.stringOf('entities[i].handle');
    j = 0;
    countJ = json.sizeOfArray('entities[i].roles');
    while (j < countJ) {
      json.j = j;
      strVal = json.stringOf('entities[i].roles[j]');
      j++;
    }

    j = 0;
    countJ = json.sizeOfArray('entities[i].publicIds');
    while (j < countJ) {
      json.j = j;
      vType = json.stringOf('entities[i].publicIds[j].type');
      identifier = json.stringOf('entities[i].publicIds[j].identifier');
      j++;
    }

    j = 0;
    countJ = json.sizeOfArray('entities[i].vcardArray');
    while (j < countJ) {
      json.j = j;
      strVal = json.stringOf('entities[i].vcardArray[j]');
      k = 0;
      countK = json.sizeOfArray('entities[i].vcardArray[j]');
      while (k < countK) {
        json.k = k;
        json.objectOf2('entities[i].vcardArray[j][k]', json1);

        i1 = 0;
        countI1 = json1.sizeOfArray('');
        while (i1 < countI1) {
          json1.i = i1;
          strVal = json1.stringOf('[i]');
          i1++;
        }

        k++;
      }

      j++;
    }

    j = 0;
    countJ = json.sizeOfArray('entities[i].entities');
    while (j < countJ) {
      json.j = j;
      objectClassName = json.stringOf('entities[i].entities[j].objectClassName');
      k = 0;
      countK = json.sizeOfArray('entities[i].entities[j].roles');
      while (k < countK) {
        json.k = k;
        strVal = json.stringOf('entities[i].entities[j].roles[k]');
        k++;
      }

      k = 0;
      countK = json.sizeOfArray('entities[i].entities[j].vcardArray');
      while (k < countK) {
        json.k = k;
        strVal = json.stringOf('entities[i].entities[j].vcardArray[k]');
        json.objectOf2('entities[i].entities[j].vcardArray[k]', json1);

        i1 = 0;
        countI1 = json1.sizeOfArray('');
        while (i1 < countI1) {
          json1.i = i1;
          j1 = 0;
          countJ1 = json1.sizeOfArray('[i]');
          while (j1 < countJ1) {
            json1.j = j1;
            strVal = json1.stringOf('[i][j]');
            j1++;
          }

          i1++;
        }

        k++;
      }

      j++;
    }

    i++;
  }

  i = 0;
  countI = json.sizeOfArray('events');
  while (i < countI) {
    json.i = i;
    eventAction = json.stringOf('events[i].eventAction');
    eventDate = json.stringOf('events[i].eventDate');
    i++;
  }

  i = 0;
  countI = json.sizeOfArray('nameservers');
  while (i < countI) {
    json.i = i;
    objectClassName = json.stringOf('nameservers[i].objectClassName');
    ldhName = json.stringOf('nameservers[i].ldhName');
    i++;
  }

  i = 0;
  countI = json.sizeOfArray('rdapConformance');
  while (i < countI) {
    json.i = i;
    strVal = json.stringOf('rdapConformance[i]');
    i++;
  }

  i = 0;
  countI = json.sizeOfArray('notices');
  while (i < countI) {
    json.i = i;
    title = json.stringOf('notices[i].title');
    j = 0;
    countJ = json.sizeOfArray('notices[i].description');
    while (j < countJ) {
      json.j = j;
      strVal = json.stringOf('notices[i].description[j]');
      j++;
    }

    j = 0;
    countJ = json.sizeOfArray('notices[i].links');
    while (j < countJ) {
      json.j = j;
      href = json.stringOf('notices[i].links[j].href');
      vType = json.stringOf('notices[i].links[j].type');
      j++;
    }

    i++;
  }
}