I'm trying to send a GET request to the Propublica congress API using RStudio. Here's their webpage: https://www.propublica.org/datastore/api/propublica-congress-api
This is what my code looks like to retrieve data from the propublica API:
httr::add_headers("X-API-Key" = "[MY API KEY]")
baseUrl2 <- "https://api.propublica.org/congress/"
path2 <- "v1/"
fullURL2 <- paste0(baseUrl2, path2)
googleResult2 <- GET(fullURL2, query=list(address="[MY ADDRESS]", key= "[MY API KEY]"))
content(googleResult2, "text")
When I run this code, however, I get the error message:
No encoding supplied: defaulting to UTF-8
"{\"message\":\"Missing Authentication Token\"}"
(I've replaced my actual API key and a shipping address that I'm currently using for [MY API KEY] and [MY ADDRESS] just for demonstration purposes.)
Running this code returns a 403 error when checking the googleResult2 variable. What should I do to fix my code and be able to access the site's API?