DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vSbResponse
Handle hoSbResponse
Integer iStatusCode
Handle hoJson
String sValue
String sRel
String sHref
String sV_type
String sStrVal
Integer j
Integer iCount_j
String sIdentifier
Integer k
Integer iCount_k
1 Handle hoJson1
Integer iI1
Integer iCount_i1
Integer iJ1
Integer iCount_j1
String sEventAction
String sEventDate
String sTitle
String sObjectClassName
String sHandle
String sLdhName
Boolean iDelegationSigned
Integer i
Integer iCount_i
String sTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// 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"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponse
If (Not(IsComObjectCreated(hoSbResponse))) Begin
Send CreateComObject of hoSbResponse
End
Get pvComObject of hoSbResponse to vSbResponse
Get ComQuickGetSb Of hoHttp "https://rdap.org/domain/oracle.com" vSbResponse To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComLastStatus Of hoHttp To iStatusCode
If (iStatusCode <> 200) Begin
Showln "Error response:"
Get ComGetAsString Of hoSbResponse To sTemp1
Showln sTemp1
Showln "status code: " iStatusCode
Procedure_Return
End
// Load the JSON response and examine..
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get pvComObject of hoSbResponse to vSbResponse
Get ComLoadSb Of hoJson vSbResponse To iSuccess
Set ComEmitCompact Of hoJson To False
Get ComEmit Of hoJson To sTemp1
Showln sTemp1
// 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"
// }
// ]
// }
// ]
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson1
If (Not(IsComObjectCreated(hoJson1))) Begin
Send CreateComObject of hoJson1
End
Get ComStringOf Of hoJson "objectClassName" To sObjectClassName
Get ComStringOf Of hoJson "handle" To sHandle
Get ComStringOf Of hoJson "ldhName" To sLdhName
Get ComBoolOf Of hoJson "secureDNS.delegationSigned" To iDelegationSigned
Move 0 To i
Get ComSizeOfArray Of hoJson "links" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "links[i].value" To sValue
Get ComStringOf Of hoJson "links[i].rel" To sRel
Get ComStringOf Of hoJson "links[i].href" To sHref
Get ComStringOf Of hoJson "links[i].type" To sV_type
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "status" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "status[i]" To sStrVal
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "entities" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "entities[i].objectClassName" To sObjectClassName
Get ComStringOf Of hoJson "entities[i].handle" To sHandle
Move 0 To j
Get ComSizeOfArray Of hoJson "entities[i].roles" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJson To j
Get ComStringOf Of hoJson "entities[i].roles[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJson "entities[i].publicIds" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJson To j
Get ComStringOf Of hoJson "entities[i].publicIds[j].type" To sV_type
Get ComStringOf Of hoJson "entities[i].publicIds[j].identifier" To sIdentifier
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJson "entities[i].vcardArray" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJson To j
Get ComStringOf Of hoJson "entities[i].vcardArray[j]" To sStrVal
Move 0 To k
Get ComSizeOfArray Of hoJson "entities[i].vcardArray[j]" To iCount_k
While (k < iCount_k)
Set ComK Of hoJson To k
Get pvComObject of hoJson1 to vJson1
Get ComObjectOf2 Of hoJson "entities[i].vcardArray[j][k]" vJson1 To iSuccess
Move 0 To iI1
Get ComSizeOfArray Of hoJson1 "" To iCount_i1
While (iI1 < iCount_i1)
Set ComI Of hoJson1 To iI1
Get ComStringOf Of hoJson1 "[i]" To sStrVal
Move (iI1 + 1) To iI1
Loop
Move (k + 1) To k
Loop
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJson "entities[i].entities" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJson To j
Get ComStringOf Of hoJson "entities[i].entities[j].objectClassName" To sObjectClassName
Move 0 To k
Get ComSizeOfArray Of hoJson "entities[i].entities[j].roles" To iCount_k
While (k < iCount_k)
Set ComK Of hoJson To k
Get ComStringOf Of hoJson "entities[i].entities[j].roles[k]" To sStrVal
Move (k + 1) To k
Loop
Move 0 To k
Get ComSizeOfArray Of hoJson "entities[i].entities[j].vcardArray" To iCount_k
While (k < iCount_k)
Set ComK Of hoJson To k
Get ComStringOf Of hoJson "entities[i].entities[j].vcardArray[k]" To sStrVal
Get pvComObject of hoJson1 to vJson1
Get ComObjectOf2 Of hoJson "entities[i].entities[j].vcardArray[k]" vJson1 To iSuccess
Move 0 To iI1
Get ComSizeOfArray Of hoJson1 "" To iCount_i1
While (iI1 < iCount_i1)
Set ComI Of hoJson1 To iI1
Move 0 To iJ1
Get ComSizeOfArray Of hoJson1 "[i]" To iCount_j1
While (iJ1 < iCount_j1)
Set ComJ Of hoJson1 To iJ1
Get ComStringOf Of hoJson1 "[i][j]" To sStrVal
Move (iJ1 + 1) To iJ1
Loop
Move (iI1 + 1) To iI1
Loop
Move (k + 1) To k
Loop
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "events" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "events[i].eventAction" To sEventAction
Get ComStringOf Of hoJson "events[i].eventDate" To sEventDate
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "nameservers" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "nameservers[i].objectClassName" To sObjectClassName
Get ComStringOf Of hoJson "nameservers[i].ldhName" To sLdhName
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "rdapConformance" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "rdapConformance[i]" To sStrVal
Move (i + 1) To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "notices" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "notices[i].title" To sTitle
Move 0 To j
Get ComSizeOfArray Of hoJson "notices[i].description" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJson To j
Get ComStringOf Of hoJson "notices[i].description[j]" To sStrVal
Move (j + 1) To j
Loop
Move 0 To j
Get ComSizeOfArray Of hoJson "notices[i].links" To iCount_j
While (j < iCount_j)
Set ComJ Of hoJson To j
Get ComStringOf Of hoJson "notices[i].links[j].href" To sHref
Get ComStringOf Of hoJson "notices[i].links[j].type" To sV_type
Move (j + 1) To j
Loop
Move (i + 1) To i
Loop
End_Procedure