2 messages in com.googlegroups.adwords-apineed help: report service issue. usin...| From | Sent On | Attachments |
|---|---|---|
| 773s...@gmail.com | 19 Nov 2006 21:47 | |
| 773s...@gmail.com | 19 Nov 2006 22:10 |
| Subject: | need help: report service issue. using SOAP:Lite![]() |
|---|---|
| From: | 773s...@gmail.com (773s...@gmail.com) |
| Date: | 11/19/2006 09:47:38 PM |
| List: | com.googlegroups.adwords-api |
Hi,
I am new to API and hardly getting any luck to get first api to work. I am trying the sample programs to get some reports. It amazes me, the sample program does not work out of the box, or error text is misleading.
I am getting this error: "Application information missing."
when i try the api to schedule a custom report using the sample program as given on adword site. (listed below)
I also tried the sandbox to verify it is not a token issue. But got error internal error:
Any help is greatly appreicated.
------------------ $url = "http://adwords.google.com/api/adwords/v7/ReportService?WSDL"; #$url = "https://sandbox.google.com/api/adwords/v7/CampaignService?wsdl";
$email = 'oo'; $password = 'boo';
$useragent = 'mg'; $token = '************';
my $namespace = "https://adwords.google.com/api/adwords/v7";
# Set up the connection to the server. my $service = SOAP::Lite->service($url);
# Disable autotyping. $service->autotype(0);
# Uncomment this line to display the XML request/response. $service->on_debug( sub { print @_ } );
# Register a fault handler. $service->on_fault(\&faulthandler);
my @headers =
(SOAP::Header->name("email")->value($email)->uri($namespace)->prefix("api"),
SOAP::Header->name("password")->value($password)->uri($namespace)->prefix("api"),
SOAP::Header->name("useragent")->value($useragent)->uri($namespace)->prefix("api"),
SOAP::Header->name("token")->value($token)->uri($namespace)->prefix("api"));
# Call if using sand box #createCampaign();
# call program to schedule report getReport();
sub getReport { my $report = { 'name' => 'test', 'aggregationType' => 'Summary', 'startDate' => '2006-10-10T00:00:00', 'endDate' => '2006-10-11T00:00:00', 'campaigns' => 1234567, 'customOptions' => SOAP::Data->value("AveragePosition", "Clicks", "Cpc", "Impressions"), }; my $req = SOAP::Data->name("customReportJob", $report); $req->attr( { 'xsi:type' => 'api:CustomReportJob', 'xmlns:api' => $namespace, });
sub createCampaign { # Create the new Campaign structure.
my $campaign = { 'dailyBudget' => 70000, 'status' => 'Paused', # Target English and Spanish 'languageTargeting' => \SOAP::Data->name('languages')->value("en", "es"), # Target one state 'geoTargeting' => { "regions" => "US-ID" }, };
# Call the service. The return value is the full data for the new campaign. my $data = $service->addCampaign($campaign, @headers);
print "The new campaign is named '" . $data->{"name"}; print "' and has ID " . $data->{"id"} . "\n";
# The 'languages' parameter might be a scalar or an array. This demonstrates # how to cast the result to always be an array. my @return_langs = array($data->{"languageTargeting"}{"languages"});
print "The campaign targets languages " . join(',', @return_langs) . "\n";
}
### Helper functions
sub faulthandler { my ($soap, $res) = @_; die("SOAP Fault: " . $res->faultstring . " for input \"" . $res->faultdetail->{"trigger"} . "\" (Error Code " . $res->faultdetail->{"code"} . ")"); }
# Convert the argument to an array. # If the argument is an array reference, it is returned after being cast # to an array. If the argument is anything else, a one-element array # containing that value is returned. sub array { my ($x) = @_; ref($x) eq "ARRAY" ? @$x : ( $x ); }




