使用 R 访问 Google 的 Campaign Manager 360 报告 API

问题描述 投票:0回答:1

我正在尝试使用 R 中的 httr 包访问 Campaign Manager 360 报告 API。这是我迄今为止运行的用于测试连接的代码,但我不断收到 403 错误代码。我已经在 Google Console 上创建了 API 凭据,并且 Campaign Manager API 已在 Google Console 应用程序上激活。 R 中的许多预设包似乎都链接回不再有效的旧网址。

我正在尝试提取通过 CM360 运行的营销活动的营销活动指标数据。

这是我到目前为止的代码。任何建议都非常感激!

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))
r httr dfareporting
1个回答
0
投票

这不是答案,但有人使用 Python 使用 Google Cloud Function 的 GCP 完成了此操作吗?

© www.soinside.com 2019 - 2024. All rights reserved.