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參數中。 –