# LAST UPDATE: 20-03-2021
# Install & Load the packages
install.packages("googleAuthR")
install.packages("tidyverse")
install.packages("readr")
# Set credentials and scope
clientId <- "PASTE HERE YOUR CLIENT ID"
clientSecret <- "PASTE HERE YOUR CLIENT SECRET"
scope <- "https://www.googleapis.com/auth/indexing"
options("googleAuthR.client_id" = clientId,
"googleAuthR.client_secret" = clientSecret,
"googleAuthR.scopes.selected" = scope,
"googleAuthR.verbose" = 0 # Not mandatory - I just use it to debug the script
# List of URLs - Daily Limit of 200 URLs
urls <- read_csv("~/Desktop/Your-file-name.csv")
# indexingApi function - you can use the function to send requestes to the indexing API using urls vector as an input
# It also GET the response from the API and stores it in a data frame
indexingApi <- function(page) {
f <- gar_api_generator("https://indexing.googleapis.com/v3/urlNotifications:publish",
result <- f(the_body = body)
result <- as.data.frame(result[[6]][[1]][[2]])
# The API responses are stored in a data frame
# You can download the API responses as .csv file
write.csv(APIResponse, "Your-file-name.csv")