Skip to content

Commit

Permalink
PowerShell sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
whoisxmlapi committed Jul 20, 2018
1 parent 9483a17 commit 3d5112f
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions powershell/reverse_whois_api_v2.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
########################
# Fill in your details #
########################

$apiKey = 'Your reverse whois api key'

$paramsAdvanced = @{
advancedSearchTerms = @(
@{
field = 'RegistrantContact.Name'
term = 'Test'
}
)
apiKey = $apiKey
mode = 'purchase'
sinceDate = '2018-07-15'
} | ConvertTo-Json

$paramsBasic = @{
basicSearchTerms = @{
include = @(
'test'
)
exclude = @(
'whois',
'api'
)
}
apiKey = $apiKey
mode = 'purchase'
sinceDate = '2018-07-15'
} | ConvertTo-Json

#######################
# POST request #
#######################

$uri = 'https://reverse-whois-api.whoisxmlapi.com/api/v2'

$response = Invoke-WebRequest -Uri $uri -Method POST -Body $paramsBasic `
-ContentType 'application/json'

echo 'Basic:'
echo $response.content | convertfrom-json | convertto-json -depth 10

$response = Invoke-WebRequest -Uri $uri -Method POST -Body $paramsAdvanced `
-ContentType 'application/json'

echo 'Advanced:'
echo $response.content | convertfrom-json | convertto-json -depth 10

0 comments on commit 3d5112f

Please sign in to comment.