#' Area Value Graphs
#'
#' Generate a graph of values for an outcode over the previous 3 months and return the URL to the generated image.
#' Please note that the output type must always be "outcode" for this method and therefore
#' an area sufficient to produce an outcode is required.
#'
#' @import httr
#'
#' @param area A string representing a valid UK outcode, e.g. "W12".
#' @param API_key An API key from Zoopla.
#'
#' @return A list.
#' @export
#'
#' @references \url{http://developer.zoopla.com/docs/read/Area_Value_Graphs}
#'
#' @examples
#' \dontrun{
#'
#' area_value_graphs("W12", "YOUR_API_KEY")
#' }
area_value_graphs <- function(area=NULL, API_key=NULL){
if (!is.character(area) || nchar(area) < 2) {
stop("Please provide a valid UK outcode.")
}
if (!is.character(API_key)) {
stop("Please provide an API key.")
}
area <- gsub(" ", "", area, fixed = TRUE)
r <- GET(paste0("https://api.zoopla.co.uk/api/v1/area_value_graphs.js?area=",
area,
"&output_type=outcode&api_key=",
API_key))
warn_for_status(r)
content(r, encoding="UTF-8")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.