0
我正尝试使用Google(分析)中的REST Web服务API,并且我得到的是毫无意义的响应,而不是Google Analytics中的预期数据。谷歌分析API问题
这里是我的要求和相应的响应:
GET /auth/analytics.readonly?ids=ga:12660456&start-date=2012-01-01&end-date=2012-02-02&metrics=ga:visits HTTP/1.1
Host: www.googleapis.com
Authorization: OAuth ya29.mytokenhere
HTTP/1.1 200 OK
status: 200
content-length: 18
x-xss-protection: 1; mode=block
content-location: https://www.googleapis.com/auth/analytics.readonly?ids=ga:12660456&start-date=2012-01-01&end-date=2012-02-02&metrics=ga:visits
x-content-type-options: nosniff
x-google-cache-control: remote-fetch
expires: Mon, 21 May 2012 19:52:57 GMT
server: GSE
via: HTTP/1.1 GWA
cache-control: private, max-age=0
date: Mon, 21 May 2012 19:52:57 GMT
x-frame-options: SAMEORIGIN
content-type: text/plain
-content-encoding: gzip
analytics.readonly
任何人都可以请帮助?
问候,
谢谢。我不确定我是否关注你...你的意思是我使用了错误的网址吗?我试着从网址中删除“auth”,结果是404。 – balteo
我的意思是,“https://www.googleapis.com/auth/analytics.readonly”这个网址并不是要通过URL检索 - - 它是您想要请求访问的标识符。它可能只是字符串“analytics.readonly”,因为这是它传达的唯一信息。按照我链接到的文档中的说明向https://accounts.google.com/o/oauth2/auth?scope = https://www.googleapis.com/auth/analytics.readonly&...发送请求获取授权码,然后访问您需要的令牌。 –
这可能是一个比以前链接的文档更为相关的文档:https://developers.google.com/accounts/docs/OAuth2WebServer - 请记住'analytics.readonly'字符串是您请求的*作用域,所以你会把它放在'?scope ='URL参数中。 –