Sample code for 30+ languages & platforms
Go

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

Go
    success := false

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

    http := chilkat.NewHttp()

    // 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"
    sbResponse := chilkat.NewStringBuilder()
    success = http.QuickGetSb("https://rdap.org/domain/oracle.com",sbResponse)
    if success == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        sbResponse.DisposeStringBuilder()
        return
    }

    statusCode := http.LastStatus()
    if statusCode != 200 {
        fmt.Println("Error response:")
        fmt.Println(*sbResponse.GetAsString())
        fmt.Println("status code: ", statusCode)
        http.DisposeHttp()
        sbResponse.DisposeStringBuilder()
        return
    }

    // Load the JSON response and examine..

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

    json := chilkat.NewJsonObject()
    json.LoadSb(sbResponse)
    json.SetEmitCompact(false)
    fmt.Println(*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 *string = new(string)
    var rel *string = new(string)
    var href *string = new(string)
    var v_type *string = new(string)
    var strVal *string = new(string)
    var j int
    var count_j int
    var identifier *string = new(string)
    var k int
    var count_k int
    json1 := chilkat.NewJsonObject()
    var i1 int
    var count_i1 int
    var j1 int
    var count_j1 int
    var eventAction *string = new(string)
    var eventDate *string = new(string)
    var title *string = new(string)

    objectClassName := json.StringOf("objectClassName")
    handle := json.StringOf("handle")
    ldhName := json.StringOf("ldhName")
    DelegationSigned := json.BoolOf("secureDNS.delegationSigned")
    i := 0
    count_i := json.SizeOfArray("links")
    for i < count_i {
        json.SetI(i)
        value = json.StringOf("links[i].value")
        rel = json.StringOf("links[i].rel")
        href = json.StringOf("links[i].href")
        v_type = json.StringOf("links[i].type")
        i = i + 1
    }

    i = 0
    count_i = json.SizeOfArray("status")
    for i < count_i {
        json.SetI(i)
        strVal = json.StringOf("status[i]")
        i = i + 1
    }

    i = 0
    count_i = json.SizeOfArray("entities")
    for i < count_i {
        json.SetI(i)
        objectClassName = json.StringOf("entities[i].objectClassName")
        handle = json.StringOf("entities[i].handle")
        j = 0
        count_j = json.SizeOfArray("entities[i].roles")
        for j < count_j {
            json.SetJ(j)
            strVal = json.StringOf("entities[i].roles[j]")
            j = j + 1
        }

        j = 0
        count_j = json.SizeOfArray("entities[i].publicIds")
        for j < count_j {
            json.SetJ(j)
            v_type = json.StringOf("entities[i].publicIds[j].type")
            identifier = json.StringOf("entities[i].publicIds[j].identifier")
            j = j + 1
        }

        j = 0
        count_j = json.SizeOfArray("entities[i].vcardArray")
        for j < count_j {
            json.SetJ(j)
            strVal = json.StringOf("entities[i].vcardArray[j]")
            k = 0
            count_k = json.SizeOfArray("entities[i].vcardArray[j]")
            for k < count_k {
                json.SetK(k)
                json.ObjectOf2("entities[i].vcardArray[j][k]",json1)

                i1 = 0
                count_i1 = json1.SizeOfArray("")
                for i1 < count_i1 {
                    json1.SetI(i1)
                    strVal = json1.StringOf("[i]")
                    i1 = i1 + 1
                }

                k = k + 1
            }

            j = j + 1
        }

        j = 0
        count_j = json.SizeOfArray("entities[i].entities")
        for j < count_j {
            json.SetJ(j)
            objectClassName = json.StringOf("entities[i].entities[j].objectClassName")
            k = 0
            count_k = json.SizeOfArray("entities[i].entities[j].roles")
            for k < count_k {
                json.SetK(k)
                strVal = json.StringOf("entities[i].entities[j].roles[k]")
                k = k + 1
            }

            k = 0
            count_k = json.SizeOfArray("entities[i].entities[j].vcardArray")
            for k < count_k {
                json.SetK(k)
                strVal = json.StringOf("entities[i].entities[j].vcardArray[k]")
                json.ObjectOf2("entities[i].entities[j].vcardArray[k]",json1)

                i1 = 0
                count_i1 = json1.SizeOfArray("")
                for i1 < count_i1 {
                    json1.SetI(i1)
                    j1 = 0
                    count_j1 = json1.SizeOfArray("[i]")
                    for j1 < count_j1 {
                        json1.SetJ(j1)
                        strVal = json1.StringOf("[i][j]")
                        j1 = j1 + 1
                    }

                    i1 = i1 + 1
                }

                k = k + 1
            }

            j = j + 1
        }

        i = i + 1
    }

    i = 0
    count_i = json.SizeOfArray("events")
    for i < count_i {
        json.SetI(i)
        eventAction = json.StringOf("events[i].eventAction")
        eventDate = json.StringOf("events[i].eventDate")
        i = i + 1
    }

    i = 0
    count_i = json.SizeOfArray("nameservers")
    for i < count_i {
        json.SetI(i)
        objectClassName = json.StringOf("nameservers[i].objectClassName")
        ldhName = json.StringOf("nameservers[i].ldhName")
        i = i + 1
    }

    i = 0
    count_i = json.SizeOfArray("rdapConformance")
    for i < count_i {
        json.SetI(i)
        strVal = json.StringOf("rdapConformance[i]")
        i = i + 1
    }

    i = 0
    count_i = json.SizeOfArray("notices")
    for i < count_i {
        json.SetI(i)
        title = json.StringOf("notices[i].title")
        j = 0
        count_j = json.SizeOfArray("notices[i].description")
        for j < count_j {
            json.SetJ(j)
            strVal = json.StringOf("notices[i].description[j]")
            j = j + 1
        }

        j = 0
        count_j = json.SizeOfArray("notices[i].links")
        for j < count_j {
            json.SetJ(j)
            href = json.StringOf("notices[i].links[j].href")
            v_type = json.StringOf("notices[i].links[j].type")
            j = j + 1
        }

        i = i + 1
    }


    http.DisposeHttp()
    sbResponse.DisposeStringBuilder()
    json.DisposeJsonObject()
    json1.DisposeJsonObject()