View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Johnny Shen > Yahoo-Marketing-APT-6.01 > Yahoo::Marketing::APT



Annotate this POD


New  1
Open  0
View/Report Bugs
Module Version: 6.01   Source  


Yahoo::Marketing::APT - an interface for Yahoo! Search Marketing's APT Web Services.


Version 6.01


This collection of modules makes interacting with Yahoo! Search Marketing's APT Web Services as easy as possible.

Note that this version (0.x) is intended to be used with V0 of the APT web services.

Sample Usage:

    use Yahoo::Marketing::APT::Site;
    use Yahoo::Marketing::APT::SiteService;

    my $service = Yahoo::Marketing::APT::SiteService->new;

    # setup your credentials

    $service->username( 'your username' );
    $service->password( 'your password' );
    $service->license( 'your license' );
    $service->account( 'your account ID' );
    $service->endpoint( '' );

    # OR

    $service->parse_config( section => 'sandbox' );

    # create a site object, and add it

    my $site = Yahoo::Marketing::APT::Site->new
                                          ->name( $site_name )
                                          ->url( '' )
                                          ->description( 'some description text' )

    my $site_response = $service->addSite( site => $site );

   # added site will have ID set

    my $added_site = $site_response->site;


This version of Yahoo::Marketing::APT is intended to be used with V0 of Yahoo's Marketing API.


Yahoo! Search Marketing's APT API allows you to manage your search marketing APT account in an automated fashion rather than manually.

This Yahoo::Marketing::APT module is a set of sub-classes of Yahoo::Marketing. Therefore, Yahoo::Marketing is a prerequisite of this module. And Yahoo::Marketing::APT inherits all the features from Yahoo::Marketing. see

The calls you can make to the various services are documented on YSM's Technology Solutions Portal. See


No exported functions


There are no methods available in Yahoo::Marketing::APT directly. All functionality is exposed by the various Service modules and complex types.

See perldoc Yahoo::Marketing::Service for service use

And perldoc Yahoo::Marketing::ComplexTypes for Complex Type documentation


Example Code

Please see Perl example code at Yahoo! Developer Network:

Example 1 - creating a site (from SiteService)

  my $site_service = Yahoo::Marketing::APT::SiteService->new
                                                       ->parse_config( section => 'sandbox' );
  # create a site
  my $site_response = $site_service->addSite( site =>
                                                     ->name( 'my site' )
                                                     ->url( '' )
  my $site = $site_response->site;

  # $site now contains the newly created site.
  # $site->ID will be set to the ID assigned to the new site.

Example 2 - updating folders (from FolderService)

  my $folder_service = Yahoo::Marketing::APT::FolderService->new
                                                           ->parse_config( section => 'sandbox' );
  my @responses = $folder_service->updateFolders(
                      folders => [ Yahoo::Marketing::APT::Folder->new
                                                                ->ID( '10456' )  # ID of existing folder
                                                                ->name( 'new folder name 1' )
                                                                ->ID( '10982' )  # ID of existing folder
                                                                ->name( 'new folder name 2' )
                                  ] );
  my $folder1 = $responses[0]->folder;
  my $folder2 = $responses[1]->folder;

Example 3 - submitting a request for a report (from ReportService)

  my $report_service = Yahoo::Marketing::APT::ReportService->new->parse_config( section => 'sandbox' );

  # get available reports
  my @reports = $report_service->getAvailableReports();
  foreach my $report (@reports) {
      print ("context: " . $report->context . "; name: " . $report->name . "\n");

  # submit the report request, we choose one report name on Account context level.
  my $report_request = Yahoo::Marketing::APT::ReportRequest->new
                                                           ->contextID( $report_service->account )
                                                           ->reportName( 'SalesCompensation' )
                                                           ->dateRange( 'Yesterday' )
  my $report_id = $report_service->addSavedReportRequest(
      reportRequest => $report_request,

  # $report_id now contains the ID for this submitted report.

Example 4 - clearing the location cache from the command line

The following code will clear the location cache from the command line on a *nix machine.

  perl -MYahoo::Marketing::APT::Service -e 'my $ysm_ws = Yahoo::Marketing::APT::Service->new->clear_cache;'

On windows, using double quotes instead of single quotes should work.

Example Config File

Config files are expected to be in YAML format. See perldoc YAML.

default_account is optional. If present, it will be set when a config file is loaded only if an account has not already been set!

Please note: masterAccountID is not required in Yahoo APT Web Services Request SOAP header, so master_account entry is optional for config file in Yahoo::Marketing::APT.

   default_account: 12345678
   license: your-ews-license
   password: secretpassword
   username: defaultusername
   version: V6
   default_account: 21921327
   license: 90837ada-3b26-c2e5-6d59-61d7f2fb578e
   password: mypassword
   username: mytestusername
   version: V6


If you'd like to see the SOAP requests and responses, or other debugging information available from SOAP::Lite, you can turn it on just as you would for SOAP::Lite. See perldoc SOAP::Trace. As an example, if you wanted to see all trace information available, you could add the following to whatever module or script you use Yahoo::Marketing in:

 use SOAP::Lite +trace;


Johnny Shen <nycperl at>


Please report any bugs or feature requests to bug-yahoo-marketing-apt at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Yahoo::Marketing::APT

You can also look for information at:


Thanks Jeff Lavallee, <jeff at>, the author of Yahoo::Marketing. Without his great work for Yahoo::Marketing, these APT sub modules won't have been possible.


Copyright (c) 2008 Yahoo! Inc. All rights reserved. The copyrights to the contents of this file are licensed under the Perl Artistic License (ver. 15 Aug 1997)

syntax highlighting: