Load the necessary packages: httr and jsonlite

#install.packages(“httr”) #install.packages(“jsonlite”) library(httr) library(jsonlite) library(dplyr)

Set up the API endpoint URL and the API key as variables.

url <- “https://www.reed.co.uk/api/1.0/search?keywords=analyst&locationName=London&distancefromlocation=55&employerId=575264&resultsToTake=100

api_key <- authenticate( user = “561a4932-c798-443c-a06f-3848f801efb3”, password = ““, type =”basic”)

Create an empty list to store the API responses.

responses <- list()

Set up a for loop that iterates over a sequence of values that you want to query the API for.

seq(from = 1, to = 1001, by = 100) # Create a sequence going up by 100

for (i in seq(from = 1, to = 1001, by = 100)) {

# Construct the API request URL with the i value and the API key

req_url <- paste0(url, “&resultsToSkip=”, i)

# Send the API request using the GET() function from the httr package

response <- GET(req_url, api_key)

# Parse the JSON response using the fromJSON() function from the jsonlite package

response_json <- fromJSON(content(response, “text”))

# Store the response in the list

responses[[i]] <- response_json$results

}

View first table in the list

View(responses[[1]])

View second table in the list - no data as we skipped to 101

View(responses[[2]])

View table 101 in the list - second table with data

View(responses[[101]])

Combine all tables in the list that have data using bind_rows in dplyr

jobs <- bind_rows(responses)