I had the same challenge as mwunit11: the response I got back from the sandbox was:
{"total_num_entries":0,"page_type":"CampaignPage","total_budget":{"period":"DAILY","amount":{"comparable_value_type":"Money","micro_amount":0}}}
(parsed it as JSON ... I use Rails so this seemed more natural)
so clearly the call is working since I'm getting something back. But it's not what I expected from the Sandbox. Also **why** is the documentation so unfriendly in explaining what to do next? It's written from the perspective of someone who already knows how to work with the API, not from the perspective of someone trying to learn the API.
Anyway, my short code (based completely on Examples found online):
def example1
adwords = setup_adwords
#adwords = AdwordsApi::Api.new
campaign_srv = adwords.service(:CampaignService, :v201109_1)
# Get 'Id', 'Name' and 'Status' fields of all campaigns.
campaigns = campaign_srv.get({:fields => ['Id', 'Name', 'Status']})
respond_with campaigns.to_json
end
and
def setup_adwords
adwords = AdwordsApi::Api.new({
:authentication => {
:method => 'ClientLogin',
:developer_token => 'MY_EMAIL_HERE++USD',
:user_agent => 'Ruby Sample',
:password => 'MY_PASSWORD_HERE',
:email => 'MY_EMAIL_HERE'
},
:service => {
:environment => 'SANDBOX'
}
});
end