-
-
Save digideskio/bc5794bcbbb1eadb23da00fbebce62bf to your computer and use it in GitHub Desktop.
Care Quality Commission (CQC) - Basic PowerShell script to query Providers API (https://api.cqc.org.uk/public/v1/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'https://api.cqc.org.uk/public/v1/' | |
$proxy = 'http://proxy:8000' | |
$limit = '1000000' | |
#$limit = '5' | |
$name = 'partnerCode={{ YOUR COMPANY NAME \ CODE }}' | |
#$limit = '5' | |
$providersUrl = $url+"providers?perPage=$limit&$name" | |
Write-Host $providersUrl | |
$r = Invoke-WebRequest -Uri $providersUrl -Method GET -ProxyUseDefaultCredentials -Proxy $proxy | |
$items = $r.Content | ConvertFrom-Json | |
#Write-Host $items.total | |
$count = 0 | |
$output = '' | |
foreach ($item in $items.providers) | |
{ | |
$count = $count + 1 | |
$providerUrl = $url+"providers/"+$item.providerId+"/?"+$name | |
#Write-Host $count = $providerUrl | |
$r = Invoke-WebRequest -Uri $providerUrl -Method GET -ProxyUseDefaultCredentials -Proxy $proxy | |
$provider = $r.Content | ConvertFrom-Json | |
$out = $provider.providerId + ',' + $provider.name + ',' + $provider.postalCode + ',' + $provider.currentRatings.overall.rating | |
#Write-Host $out | |
$output = $output + $out + "`n" | |
#Write-Host $output | |
} | |
Write-Host $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment