Grab 'DataForSeo' API data x
⚠️ THIS IS A WORK IN PROGRESS

What is DataForSeo?

DataForSEO is a paid API that provides SEO data

How to use the API?

First, you need to grab your credentials can be found inside your personal dashboard
DataForSEO
1
# great package for working with HTTP requests
2
library(httr)
3
4
# credentials can be found here https://app.dataforseo.com/api-dashboard
5
username <- "APILOGIN"
6
password <- "APIPWD"
7
8
headers = c(
9
`Authorization` = paste('Basic',base64_enc(paste0(username,":",password))),
10
`Content-Type` = 'application/json'
11
)
Copied!

Sample request asking for a keywords position

1
data = '[{"keyword":"r for seo",
2
"location_code":2826,
3
"language_code":"en",
4
"device":"desktop",
5
"os":"windows"}]'
Copied!
We are asking for the position of the keyword "r for seo" from an IP in England (code 2826)
all the location codes are available here
1
2
res <- httr::POST(url = 'https://api.dataforseo.com/v3/serp/google/organic/live/advanced', httr::add_headers(.headers=headers), body = data)
3
4
5
res_text <- content(res, "text")
6
require(jsonlite)
7
res_json <- fromJSON(res_text, flatten = TRUE)
8
View(res_json)
Copied!
Last modified 5mo ago