R Active Campagin API Access Pagination

24 Views Asked by At

I'm accessing Active Campaign via API, and I was able to access a particular list I want, but I just had access to the first 100 observations but they are 3,567.

I'm accessing the contacts that have associated determined tags, which are 8. Tags are in the string, but I'm accessing only 100. This is the code:

tag_id_string <- c(1197, 1230, 1235, 1256, 1257, 1275,1276,1278)
tag_ids_string2 <- paste(tag_id_string, collapse = ",") 
url_c <- paste0("https://cbsaust.api-us1.com/api/3/contacts?limit=100&tagid=",tag_ids_string2)

# Request res from API
res <- VERB("GET", 
            url_c, 
            add_headers(headers))

# Print the content of the response
content <- fromJSON(content(res, "text"),)
content <- content$contacts

How can I incrust this code into a for loop, so I insert each 100 on a database, until the last one?

0

There are 0 best solutions below