API - Reed.co.uk - R Code - Key Req
# Install packages httr and jsonlite
install.packages("httr") install.packages("jsonlite") # Create a GET response to call the API ```{r} jobsearch <- httr::GET("https://www.reed.co.uk/api/1.0/search?keywords=analyst&location=london&distancefromlocation=15?details=true", httr::authenticate( user = "686dc8ba-b318-4d65-ae64-7387613517230000000000", password = "", type = "basic")) # View API GET response result str(jobsearch) # View the main source of the data needed from the API - Normally content str(jobsearch$content) ``` # Convert the raw content to text (in this case, a JSON string) ```{r} jobsearchcontent <- httr::content(jobsearch, as = "text") # View JSON String result str(jobsearchcontent) ``` # Convert the JSON string to a dataframe and view data in a table ```{r} jobsearchJSON <- jsonlite::fromJSON(jobsearchcontent) View(jobsearchJSON$results) ```
Comments
Post a Comment