Sample code for 30+ languages & platforms
PowerBuilder 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 PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_SbResponse
integer li_StatusCode
oleobject loo_Json
string ls_Value
string ls_Rel
string ls_Href
string ls_V_type
string ls_StrVal
integer j
integer li_Count_j
string ls_Identifier
integer k
integer li_Count_k
oleobject loo_Json1
integer li_I1
integer li_Count_i1
integer li_J1
integer li_Count_j1
string ls_EventAction
string ls_EventDate
string ls_Title
string ls_ObjectClassName
string ls_Handle
string ls_LdhName
integer li_DelegationSigned
integer i
integer li_Count_i

li_Success = 0

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  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"
loo_SbResponse = create oleobject
li_rc = loo_SbResponse.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://rdap.org/domain/oracle.com",loo_SbResponse)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponse
    return
end if

li_StatusCode = loo_Http.LastStatus
if li_StatusCode <> 200 then
    Write-Debug "Error response:"
    Write-Debug loo_SbResponse.GetAsString()
    Write-Debug "status code: " + string(li_StatusCode)
    destroy loo_Http
    destroy loo_SbResponse
    return
end if

//  Load the JSON response and examine..

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

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")

loo_Json.LoadSb(loo_SbResponse)
loo_Json.EmitCompact = 0
Write-Debug loo_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"
//          }
//        ]
//      }
//    ]
//  }

loo_Json1 = create oleobject
li_rc = loo_Json1.ConnectToNewObject("Chilkat.JsonObject")

ls_ObjectClassName = loo_Json.StringOf("objectClassName")
ls_Handle = loo_Json.StringOf("handle")
ls_LdhName = loo_Json.StringOf("ldhName")
li_DelegationSigned = loo_Json.BoolOf("secureDNS.delegationSigned")
i = 0
li_Count_i = loo_Json.SizeOfArray("links")
do while i < li_Count_i
    loo_Json.I = i
    ls_Value = loo_Json.StringOf("links[i].value")
    ls_Rel = loo_Json.StringOf("links[i].rel")
    ls_Href = loo_Json.StringOf("links[i].href")
    ls_V_type = loo_Json.StringOf("links[i].type")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("status")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("status[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("entities")
do while i < li_Count_i
    loo_Json.I = i
    ls_ObjectClassName = loo_Json.StringOf("entities[i].objectClassName")
    ls_Handle = loo_Json.StringOf("entities[i].handle")
    j = 0
    li_Count_j = loo_Json.SizeOfArray("entities[i].roles")
    do while j < li_Count_j
        loo_Json.J = j
        ls_StrVal = loo_Json.StringOf("entities[i].roles[j]")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("entities[i].publicIds")
    do while j < li_Count_j
        loo_Json.J = j
        ls_V_type = loo_Json.StringOf("entities[i].publicIds[j].type")
        ls_Identifier = loo_Json.StringOf("entities[i].publicIds[j].identifier")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("entities[i].vcardArray")
    do while j < li_Count_j
        loo_Json.J = j
        ls_StrVal = loo_Json.StringOf("entities[i].vcardArray[j]")
        k = 0
        li_Count_k = loo_Json.SizeOfArray("entities[i].vcardArray[j]")
        do while k < li_Count_k
            loo_Json.K = k
            loo_Json.ObjectOf2("entities[i].vcardArray[j][k]",loo_Json1)

            li_I1 = 0
            li_Count_i1 = loo_Json1.SizeOfArray("")
            do while li_I1 < li_Count_i1
                loo_Json1.I = li_I1
                ls_StrVal = loo_Json1.StringOf("[i]")
                li_I1 = li_I1 + 1
            loop
            k = k + 1
        loop
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("entities[i].entities")
    do while j < li_Count_j
        loo_Json.J = j
        ls_ObjectClassName = loo_Json.StringOf("entities[i].entities[j].objectClassName")
        k = 0
        li_Count_k = loo_Json.SizeOfArray("entities[i].entities[j].roles")
        do while k < li_Count_k
            loo_Json.K = k
            ls_StrVal = loo_Json.StringOf("entities[i].entities[j].roles[k]")
            k = k + 1
        loop
        k = 0
        li_Count_k = loo_Json.SizeOfArray("entities[i].entities[j].vcardArray")
        do while k < li_Count_k
            loo_Json.K = k
            ls_StrVal = loo_Json.StringOf("entities[i].entities[j].vcardArray[k]")
            loo_Json.ObjectOf2("entities[i].entities[j].vcardArray[k]",loo_Json1)

            li_I1 = 0
            li_Count_i1 = loo_Json1.SizeOfArray("")
            do while li_I1 < li_Count_i1
                loo_Json1.I = li_I1
                li_J1 = 0
                li_Count_j1 = loo_Json1.SizeOfArray("[i]")
                do while li_J1 < li_Count_j1
                    loo_Json1.J = li_J1
                    ls_StrVal = loo_Json1.StringOf("[i][j]")
                    li_J1 = li_J1 + 1
                loop
                li_I1 = li_I1 + 1
            loop
            k = k + 1
        loop
        j = j + 1
    loop
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("events")
do while i < li_Count_i
    loo_Json.I = i
    ls_EventAction = loo_Json.StringOf("events[i].eventAction")
    ls_EventDate = loo_Json.StringOf("events[i].eventDate")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("nameservers")
do while i < li_Count_i
    loo_Json.I = i
    ls_ObjectClassName = loo_Json.StringOf("nameservers[i].objectClassName")
    ls_LdhName = loo_Json.StringOf("nameservers[i].ldhName")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("rdapConformance")
do while i < li_Count_i
    loo_Json.I = i
    ls_StrVal = loo_Json.StringOf("rdapConformance[i]")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("notices")
do while i < li_Count_i
    loo_Json.I = i
    ls_Title = loo_Json.StringOf("notices[i].title")
    j = 0
    li_Count_j = loo_Json.SizeOfArray("notices[i].description")
    do while j < li_Count_j
        loo_Json.J = j
        ls_StrVal = loo_Json.StringOf("notices[i].description[j]")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_Json.SizeOfArray("notices[i].links")
    do while j < li_Count_j
        loo_Json.J = j
        ls_Href = loo_Json.StringOf("notices[i].links[j].href")
        ls_V_type = loo_Json.StringOf("notices[i].links[j].type")
        j = j + 1
    loop
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponse
destroy loo_Json
destroy loo_Json1