2017-08-01 125 views
0

當我登錄到雅虎雙子座發佈商信息中心(位於https://gemini.yahoo.com/publisher),我可以看到我所配置的發佈者ID報告。我現在試圖從Gemini REST API中獲取這些相同的數據,但是我遇到了一些混淆和錯誤。如何獲取Yahoo Gemini Publisher API報告?

根據https://developer.yahoo.com/gemini-publishers/docs/gemini-publisher-reporting.html我需要獲得OAuth2訪問令牌(我可以通過https://api.login.yahoo.com/oauth2/request_auth?client_id=GEMINI_CONSUMER_KEY&redirect_uri=MY_URL&response_type=token&language=en-us瀏覽器重定向成功完成),並撥打https://api.admanager.yahoo.com/v1/rest/reports/publisher/以獲取報告。然而,當我這樣做時,我得到一個神祕的迴應:

curl --request POST \ 
    --url http://api.admanager.yahoo.com/v1/rest/reports/publisher/ \ 
    --header 'accept: application/json' \ 
    --header 'authorization: Bearer [omitted]' \ 
    --header 'content-type: application/json' \ 
    --data '{ ... cube JSON stuff ... }' 

{"error":{"lang":"en-US","description":"Please provide valid credentials. OAuth oauth_problem=\"additional_authorization_required\", realm=\"yahooapis.com\""}} 

OAuth令牌授予訪問Gemini API的權限。我試圖通過Explicit和Implicit方法獲得OAuth令牌,結果相同。考慮到它可能是一個訪問問題,我增加了對其他API授予的權限(配置文件,聯繫人等),但沒有任何更改。

我注意到有上https://developer.yahoo.com/gemini/上市分離集合雙子座的API。這些API位於https://api.gemini.yahoo.com/v2/rest/reports/custom/,當我向他們發佈郵件時,它接受我的OAuth令牌,但是這些API的「多維數據集」需要一個「廣告客戶ID」,我不知道該從哪裏得到或者如何使用正確的API。

{ 
"errors": [ 
    { 
     "errIndex": -1, 
     "code": "E40000_INVALID_INPUT", 
     "message": "Entity (publisher or advertiser id) not available", 
     "description": "" 
    } 
], 
"response": { ... } 
} 

該消息似乎表明我可以通過發佈者ID,但是當我將它包含在「過濾器」中時,它不起作用。

當我打電話https://api.gemini.yahoo.com/v2/rest/advertiser/我沒有收到廣告回來。

,我應該使用哪個API?如果它是https://api.admanager.yahoo.com/v1/rest/reports/publisher/那麼我是否省略了一些必需的請求數據,或者我得到的令牌是否錯誤?如果我應該使用https://api.gemini.yahoo.com/v2/rest/reports/custom/,那麼我如何獲取發佈商數據(或我的「廣告客戶ID」)?

回答