1

I am trying to access campaign manager 360 Reporting API with using the httr package in R. This is the code I have run so far to test the connection and I keep getting a 403 error code. I already created the API credentials on Google Console and Campaign Manager API is activated on the Google Console App. A lot of the preset packages in R for this seem to be linking back to old urls that are no longer valid.

I am trying to pull campaign metrics data for the campaigns running through CM360.

This is the code I have so far. Any advice is truly appreciated!

library(httr)
library(jsonlite)

dcm_user_id <- "xxxxxxx"
report_id <- "xxxxxxxxx"
dcm_key <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
secret <- "xxxxxxxxxxxxxxxxxxx"

dcm_app <- oauth_app("google", key = dcm_key, secret = secret)
google_token <- oauth2.0_token(oauth_endpoints("google"), dcm_app, scope = "https://www.googleapis.com/auth/dfareporting")

# run asyncronously
data_url <- paste0("https://www.googleapis.com/dfareporting/v3.4/userprofiles/", dcm_user_id, "/ads")

dcm_report <- GET(data_url, config(token = google_token))
Ulrich
  • 43
  • 4
  • Hi All, following up here. I finally connected to cm360 API and am trying to pull different dimensions and metrics from the API. Is this something someone has done with httr before? As the connection is now successful, the next issue is actually getting the data that I need. I would really appreciate any help/advice I can get on this. – Ulrich Jul 21 '21 at 19:25
  • Did you use the same code above to successfully connect to cm360 api or did you use modified code? – Mike.Gahan Aug 10 '21 at 13:11
  • I modified the code was was able to get a 200 code, meaning I did connect to the API, but I am now struggling with the changes I need to make to the URL. Are you having a similar issue?. I changed the data URL. Here is the new one: data_url <- paste0("https://dfareporting.googleapis.com/dfareporting/v3.5/userprofiles/", dcm_user_id, "/reports/", report_id). But I want to actually build this in a different way. – Ulrich Aug 10 '21 at 14:30

0 Answers0