Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

account.profiles seems to be returning a "invalidRequestUri" #110

Open
brunogh opened this issue Jan 5, 2012 · 2 comments
Open

account.profiles seems to be returning a "invalidRequestUri" #110

brunogh opened this issue Jan 5, 2012 · 2 comments

Comments

@brunogh
Copy link

brunogh commented Jan 5, 2012

It seems that the following code stopped working on account.profiles call. Not sure if it is a temporary Google issue, but noticed today.

def accounts_and_profiles_summarized
begin
      ga_profiles = []
      session = Garb::Session.new
      session.access_token = get_oauth_access_token
      accounts = Garb::Management::Account.all(session)
      accounts.each do |a|
        account = OpenStruct.new(:name => a.name, :profiles => [])
        a.profiles.each do |p|
          account.profiles << OpenStruct.new(:title => p.title, :ua_id => p.web_property_id)
        end
        ga_profiles << account
      end
      ga_profiles
    rescue => e
      p e
    end
end
- GAClient raises error at accounts_and_profiles_summarized:75: "<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>invalidRequestUri</code><internalReason>Invalid request URI</internalReason></error></errors>"
@pedrobachiega
Copy link

If you request Garb::Management::Account.all, the entities will have the full url at path param, like "https://www.googleapis.com/analytics/v2.4/management/accounts/123" when it is just to be "/accounts/123"

Seems that this is beeing caused by Management API v2.3 Forwarding
http://groups.google.com/group/google-analytics-api-notify/browse_thread/thread/656aa688a733d5ff

@pedrobachiega
Copy link

What you could do as workaround is:

accounts = Garb::Management::Account.all(session)
      accounts.each do |a|
        account = OpenStruct.new(:name => a.name, :profiles => [])
        a.path.gsub!("https://www.googleapis.com/analytics/v2.4/management", '')
        a.profiles.each do |p|
          account.profiles << OpenStruct.new(:title => p.title, :ua_id => p.web_property_id)
        end
        ga_profiles << account
      end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants