Are you using the sandbox or live data? Do you have the proper
credentials in ENV['HOME']/adwords_api.yml ?

Pete

On Apr 22, 5:24 pm, Alex <[email protected]> wrote:
> I am using Ruby v201101 API in order to get all campaigns for my production
> account but get 0 campaigns. Below is the code from get_all_campaigns.rb
> example actually. Is data needed to be sync'd between UI and API servers? I
> can see tons of campaigns using UI and none is returned by API. Do I need to
> have different developer_token? The one I have right is used by v13 client.
> Please advise!
>
> API_VERSION = :v201101
>
> def get_all_campaigns()
>   # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
>   # when called without parameters.
>   adwords = AdwordsApi::Api.new
>   campaign_srv = adwords.service(:CampaignService, API_VERSION)
>
>   # Get all the campaigns for this account; empty selector.
>   selector = {
>     :fields => ['Id', 'Name', 'Status'],
>     :ordering => [{:field => 'Name', :sortOrder => 'ASCENDING'}]
>   }
>
>   response = campaign_srv.get(selector)
>
>   if response and response[:entries]
>     campaigns = response[:entries]
>     campaigns.each do |campaign|
>       puts "Campaign name is \"#{campaign[:name]}\", id is #{campaign[:id]}
> " +
>           "and status is \"#{campaign[:status]}\"."
>     end
>   else
>     puts "No campaigns were found."
>   end
> end

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to