Sample code for 30+ languages & platforms
Tcl

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 Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_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"
set sbResponse [new_CkStringBuilder]

set success [CkHttp_QuickGetSb $http "https://rdap.org/domain/oracle.com" $sbResponse]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkStringBuilder $sbResponse
    exit
}

set statusCode [CkHttp_get_LastStatus $http]
if {$statusCode != 200} then {
    puts "Error response:"
    puts [CkStringBuilder_getAsString $sbResponse]
    puts "status code: $statusCode"
    delete_CkHttp $http
    delete_CkStringBuilder $sbResponse
    exit
}

# Load the JSON response and examine..

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

set json [new_CkJsonObject]

CkJsonObject_LoadSb $json $sbResponse
CkJsonObject_put_EmitCompact $json 0
puts [CkJsonObject_emit $json]

# 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"
#         }
#       ]
#     }
#   ]
# }

set json1 [new_CkJsonObject]

set objectClassName [CkJsonObject_stringOf $json "objectClassName"]
set handle [CkJsonObject_stringOf $json "handle"]
set ldhName [CkJsonObject_stringOf $json "ldhName"]
set DelegationSigned [CkJsonObject_BoolOf $json "secureDNS.delegationSigned"]
set i 0
set count_i [CkJsonObject_SizeOfArray $json "links"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set value [CkJsonObject_stringOf $json "links[i].value"]
    set rel [CkJsonObject_stringOf $json "links[i].rel"]
    set href [CkJsonObject_stringOf $json "links[i].href"]
    set v_type [CkJsonObject_stringOf $json "links[i].type"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $json "status"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set strVal [CkJsonObject_stringOf $json "status[i]"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $json "entities"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set objectClassName [CkJsonObject_stringOf $json "entities[i].objectClassName"]
    set handle [CkJsonObject_stringOf $json "entities[i].handle"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $json "entities[i].roles"]
    while {$j < $count_j} {
        CkJsonObject_put_J $json $j
        set strVal [CkJsonObject_stringOf $json "entities[i].roles[j]"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $json "entities[i].publicIds"]
    while {$j < $count_j} {
        CkJsonObject_put_J $json $j
        set v_type [CkJsonObject_stringOf $json "entities[i].publicIds[j].type"]
        set identifier [CkJsonObject_stringOf $json "entities[i].publicIds[j].identifier"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $json "entities[i].vcardArray"]
    while {$j < $count_j} {
        CkJsonObject_put_J $json $j
        set strVal [CkJsonObject_stringOf $json "entities[i].vcardArray[j]"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $json "entities[i].vcardArray[j]"]
        while {$k < $count_k} {
            CkJsonObject_put_K $json $k
            CkJsonObject_ObjectOf2 $json "entities[i].vcardArray[j][k]" $json1

            set i1 0
            set count_i1 [CkJsonObject_SizeOfArray $json1 ""]
            while {$i1 < $count_i1} {
                CkJsonObject_put_I $json1 $i1
                set strVal [CkJsonObject_stringOf $json1 "[i]"]
                set i1 [expr $i1 + 1]
            }
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $json "entities[i].entities"]
    while {$j < $count_j} {
        CkJsonObject_put_J $json $j
        set objectClassName [CkJsonObject_stringOf $json "entities[i].entities[j].objectClassName"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $json "entities[i].entities[j].roles"]
        while {$k < $count_k} {
            CkJsonObject_put_K $json $k
            set strVal [CkJsonObject_stringOf $json "entities[i].entities[j].roles[k]"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $json "entities[i].entities[j].vcardArray"]
        while {$k < $count_k} {
            CkJsonObject_put_K $json $k
            set strVal [CkJsonObject_stringOf $json "entities[i].entities[j].vcardArray[k]"]
            CkJsonObject_ObjectOf2 $json "entities[i].entities[j].vcardArray[k]" $json1

            set i1 0
            set count_i1 [CkJsonObject_SizeOfArray $json1 ""]
            while {$i1 < $count_i1} {
                CkJsonObject_put_I $json1 $i1
                set j1 0
                set count_j1 [CkJsonObject_SizeOfArray $json1 "[i]"]
                while {$j1 < $count_j1} {
                    CkJsonObject_put_J $json1 $j1
                    set strVal [CkJsonObject_stringOf $json1 "[i][j]"]
                    set j1 [expr $j1 + 1]
                }
                set i1 [expr $i1 + 1]
            }
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $json "events"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set eventAction [CkJsonObject_stringOf $json "events[i].eventAction"]
    set eventDate [CkJsonObject_stringOf $json "events[i].eventDate"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $json "nameservers"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set objectClassName [CkJsonObject_stringOf $json "nameservers[i].objectClassName"]
    set ldhName [CkJsonObject_stringOf $json "nameservers[i].ldhName"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $json "rdapConformance"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set strVal [CkJsonObject_stringOf $json "rdapConformance[i]"]
    set i [expr $i + 1]
}
set i 0
set count_i [CkJsonObject_SizeOfArray $json "notices"]
while {$i < $count_i} {
    CkJsonObject_put_I $json $i
    set title [CkJsonObject_stringOf $json "notices[i].title"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $json "notices[i].description"]
    while {$j < $count_j} {
        CkJsonObject_put_J $json $j
        set strVal [CkJsonObject_stringOf $json "notices[i].description[j]"]
        set j [expr $j + 1]
    }
    set j 0
    set count_j [CkJsonObject_SizeOfArray $json "notices[i].links"]
    while {$j < $count_j} {
        CkJsonObject_put_J $json $j
        set href [CkJsonObject_stringOf $json "notices[i].links[j].href"]
        set v_type [CkJsonObject_stringOf $json "notices[i].links[j].type"]
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}

delete_CkHttp $http
delete_CkStringBuilder $sbResponse
delete_CkJsonObject $json
delete_CkJsonObject $json1