I would like to use the Open Data Communities API from R to request domestic EPC certificates.
https://epc.opendatacommunities.org/domestic/search
I have created an account and have my base 64 authentication token. I would prefer to use the httr package. Currently I'm getting a "Error: unauthorized (HTTP 401)" error. Could anyone help?
Open data communities suggest using the sparql library but this is no longer available on CRAN hence my interest in working with httr.
This is how far I have got:
library(httr)
epc_url = 'https://epc.opendatacommunities.org/api/v1/domestic/certificate/219873319402019053122194154717408'
token = 'XXXXXX'
api_key = 'XXXXXX'
r = GET(url = epc_url,
accept('text/csv'),
authenticate(token,api_key, 'basic')
)
stop_for_status(r)
Could anybody help?
Answered my own question, for anybody else out there here is how I did it.