gapi account data url goes to 404

2019-02-23 17:57发布

Does anyone know the new account data url used by the GAPI 1.3.1 class? The current one is

https://www.google.com/analytics/feeds/accounts/default but it goes to a 404

Regards,

4条回答
不美不萌又怎样
3楼-- · 2019-02-23 18:36
  • Go to : https: // code.google.com /apis/console/
  • Login and create a new project
  • Turn on Analytics API
  • Click on Analytics API link and then in the left menu choose API Access
  • Note down the API Key (Key for browser apps )

Then inside your code, where you had: https: // www.google.com/ analytics/feeds/accounts/default will be replaced with: https:// www. googleapis.com/ analytics /v2.4/management/accounts

There is one more change to do. Each call for info will have to also include the API Key as a GET param named key

Example: https://www.googleapis.com/analytics/v2.4/management/accounts?start-index=1&max-results=100&key=API_KEY

I am sorry, I am new here and I can't paste links yet. Hope to get better :)

查看更多
SAY GOODBYE
4楼-- · 2019-02-23 18:41

See Account Feed Shutdown

The Data Export API v2.3 migration has completed and the API has been shutdown. If your application attempts to access the Account Feed it will now receive a 404 error response. To resolve this error, migrate to the Management API to access configuration data.

查看更多
Bombasti
5楼-- · 2019-02-23 18:44

While using GAPI 1.3.1, you can request a list of accounts available to the user by calling the list method for accounts. In PHP this will look like:

try {
    $accounts = $analytics->management_accounts->listManagementAccounts();
} catch (apiServiceException $e) {
    print 'There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
} catch (apiException $e) {
    print 'There was a general API error ' . $e->getCode() . ':' . $e->getMessage();
}

See https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtAccountGuide for more details about querying the GA Management API with GAPI.

查看更多
登录 后发表回答