Help Center Manage Your Account AdSpeed API

Ad

Documentation for API methods to manage one or multiple ads.

API Version

1.2.5 (build 20150921). This page was updated on Mon, 05 Sep 16 09:10:24 -0400. Since the API method and response format can change from one version to another, you should check this page for updates.

API Methods - Ad

AS.Ads.getCounts

Returns the number of active, pending, deleted and total ads for this publisher or ad network
Parameters
  • None
Sample Request
Sample Response
<Ads total="6" active="2" pending="4" archived="0" deleted="0"/>

AS.Ads.getList

Returns the list of ads for this publisher or ad network
Parameters
  • perpage Optional, default value is "10"
    The number of items per page
  • page Optional, default value is "1"
    The page number
Sample Request
Sample Response
<Ads total="6" page="1" numpage="2" perpage="4">
  <Ad id="35093" name="Sample Text Ad" status="pending"/>
  <Ad id="36943" name="Sample Image Ad" status="pending" width="468" height="60"/>
  <Ad id="40631" name="Sample Rich HTML Ad" status="pending" width="300" height="250"/>
  <Ad id="54412" name="Sample Text Link Ad" status="pending"/>
</Ads>

AS.Ads.createStandard

Create a new standard/external ad (SWF, JPG, GIF, PNG, BMP) for this account. Submit via POST. Limit 50 calls/day.
Parameters
  • name Required
    The name of this ad
  • clickurl Required
    The destination URL to redirect when someone clicks on this ad (start with http://, must be URL-encoded properly)
  • imageurl Required
    The URL of an external JPG/GIF/BMP/SWF file (start with http://, must be URL-encoded properly)
Sample Request
Sample Response
<Ad id="123" name="SampleSWFAd" status="active"></Ad>

AS.Ads.createHTML

Create a new Rich-Media/HTML ad for this account. Submit via POST. Limit 50 calls/day.
Parameters
  • name Required
    The name of this ad
  • htmlbase64 Required
    The base64-encoded HTML ad code. Must be encoded using base64_encode.
  • width Required
    The ad width in pixels
  • height Required
    The ad height in pixels
Sample Request
Sample Response
<Ad id="456" name="SampleHTMLAd" status="active"></Ad>

AS.Ads.createText

Create a new text link ad for this account. Submit via POST. Limit 50 calls/day.
Parameters
  • name Required
    The name of this ad
  • first Required
    The first text line
  • next Required
    The next text line(s)
  • clickurl Required
    The destination URL to redirect when someone clicks on this ad (start with http://, must be URL-encoded properly)
Sample Request
Sample Response
<Ad id="456" name="SampleTextLinkAd" status="active"></Ad>

AS.Ad.linkToZone

Links this ad to the specified zone
Parameters
  • ad Required
    The ad identification
  • zone Required
    The zone identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Zone ID][Zone Name]
Sample Request
Sample Response
<Confirmation ad="36943" zone="7607">LINKED</Confirmation>

AS.Ad.unlinkFromZone

Unlinks this ad from the specified zone
Parameters
  • ad Required
    The ad identification
  • zone Required
    The zone identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name][Zone ID][Zone Name]
Sample Request
Sample Response
<Confirmation ad="36943" zone="7607">UNLINKED</Confirmation>

AS.Ad.edit

Edits this ad settings. Submit via POST.
Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • clickurl Optional, default value is empty
    The destination URL to redirect when someone clicks on this ad (start with http://, must be URL-encoded properly)
  • imageurl Optional, default value is empty
    The URL of an external JPG/GIF/BMP/SWF file (start with http://, must be URL-encoded properly)
  • htmlbase64 Optional, default value is empty
    The base64-encoded HTML code for a Rich-Media/HTML ad. Must be encoded using base64_encode
  • vastxmlbase64 Optional, default value is empty
    The base64-encoded XML code for the MediaFiles section of a VAST video ad. Must be encoded using base64_encode
  • width Optional, default value is empty
    The ad width in pixel
  • height Optional, default value is empty
    The ad height in pixel
  • weight Optional, default value is empty
    The ad weight/priority
  • optimizer Optional, default value is empty
    The ad optimization method. Possible value: "none", "rev", "clk", "ctr", "conv"
  • status Optional, default value is empty
    The ad status. Possible value: "active", "pending", "deleted"
Sample Request
Sample Response
<!DOCTYPE html>
<html>
  <head>
    <title>AdSpeed.com</title>
    <meta name="viewport" content="width=device-width,initial-scale=1"/>
  </head>
  <body style="margin:0px;background:#E4CBCA">
    <div style="text-align:center;width:100%;margin-top:200px"><img src="//g.adspeed.net/webroot/img/as/as_logo4.png" alt="i"/><br/><h2 style="font-family:Arial,sans-serif;">Input Issue</h2>Sorry! Input contains unsupported characters.<br/> Please go back to check your input before trying again.<br/> If it persists, please email support@adspeed.com for assistance.<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3445984-5', 'auto');
ga('send', 'pageview');
		</script>
</div>
  </body>
</html>

AS.Ad.addRestriction

Adds a restriction to this ad
Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • logic Optional, default value is "and"
    The logical operator for this restriction. Possible value: "and", "or"
  • compare Optional, default value is "show"
    The comparison operator for this restriction. Possible value: "show", "hide"
  • type Required
    The type of restriction. Possible value: "keyword", "country"
  • value Required
    The value for this restriction. Specific format and syntax applies.
Sample Request
Sample Response
<Restrictions entity="[Ad] Sample Image Ad"># Conditions
		---------------------------------------------------------
		1. Show if visitor is from United States, Canada, AND
		2. Show during the hours of 08:xx, 09:xx, 10:xx, 11:xx
		</Restrictions>

AS.Ad.getServingCode

Returns the ad tag for this ad
Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • width Required
    The ad width in pixels
  • height Required
    The ad height in pixels
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="pending" width="468" height="60">
  <ServingCode type="regular" format="comprehensive">
    <!-- AdSpeed.com  Tag 8.0.2 for [Ad] Sample Image Ad 468x60 -->
    <script type="text/javascript"><![CDATA[
	var asdate=new Date();var q='&amp;tz='+asdate.getTimezoneOffset()/60 +'&amp;ck='+(navigator.cookieEnabled?'Y':'N') +'&amp;jv='+(navigator.javaEnabled()?'Y':'N') +'&amp;scr='+screen.width+'x'+screen.height+'x'+screen.colorDepth +'&amp;z='+Math.random() +'&amp;ref='+escape(document.referrer.substr(0,255)) +'&amp;uri='+escape(document.URL.substr(0,255));document.write('<ifr'+'ame width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank'+q+'" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0"></ifr'+'ame>');
	]]></script>
    <noscript>
      <iframe width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0">
        <a href="http://g.adspeed.net/ad.php?do=clk&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" target="_blank">
          <img style="border:0px;max-width:100%;height:auto;" src="http://g.adspeed.net/ad.php?do=img&amp;aid=36943&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" width="468" height="60"/>
        </a>
      </iframe>
    </noscript>
    <!-- AdSpeed.com End -->
  </ServingCode>
</Ad>

AS.Ad.getLinkedZones

Returns the list of zones linked to this ad
Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • perpage Optional, default value is "10"
    The number of items per page
  • page Optional, default value is "1"
    The page number
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="pending" width="468" height="60">
  <Zones total="3" page="1" numpage="1" perpage="4">
    <Zone id="7549" name="Section Travel" status="active"/>
    <Zone id="7681" name="Section Music" status="active"/>
    <Zone id="20852" name="Newsletter 468x60 Ad" status="active"/>
  </Zones>
</Ad>

AS.Ad.getServingCodeForLinkedZones

Returns the list of zones linked to this ad and their ad tags
Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • perpage Optional, default value is "10"
    The number of items per page
  • page Optional, default value is "1"
    The page number
Sample Request
Sample Response
<Ad id="36943" name="Sample Image Ad" status="pending" width="468" height="60">
  <Zones total="3" page="1" numpage="2" perpage="2">
    <Zone id="7549" name="Section Travel" status="active">
      <ServingCode type="regular" format="comprehensive">
        <!-- AdSpeed.com  Tag 8.0.2 for [Zone] Section Travel 468x60 -->
        <script type="text/javascript"><![CDATA[
	var asdate=new Date();var q='&amp;tz='+asdate.getTimezoneOffset()/60 +'&amp;ck='+(navigator.cookieEnabled?'Y':'N') +'&amp;jv='+(navigator.javaEnabled()?'Y':'N') +'&amp;scr='+screen.width+'x'+screen.height+'x'+screen.colorDepth +'&amp;z='+Math.random() +'&amp;ref='+escape(document.referrer.substr(0,255)) +'&amp;uri='+escape(document.URL.substr(0,255));document.write('<ifr'+'ame width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank'+q+'" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0"></ifr'+'ame>');
	]]></script>
        <noscript>
          <iframe width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0">
            <a href="http://g.adspeed.net/ad.php?do=clk&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" target="_blank">
              <img style="border:0px;max-width:100%;height:auto;" src="http://g.adspeed.net/ad.php?do=img&amp;zid=7549&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" alt="i" width="468" height="60"/>
            </a>
          </iframe>
        </noscript>
        <!-- AdSpeed.com End -->
      </ServingCode>
    </Zone>
    <Zone id="7681" name="Section Music" status="active">
      <ServingCode type="regular" format="comprehensive">
        <!-- AdSpeed.com  Tag 8.0.2 for [Zone] Section Music 468x60 -->
        <script type="text/javascript"><![CDATA[
	var asdate=new Date();var q='&amp;tz='+asdate.getTimezoneOffset()/60 +'&amp;ck='+(navigator.cookieEnabled?'Y':'N') +'&amp;jv='+(navigator.javaEnabled()?'Y':'N') +'&amp;scr='+screen.width+'x'+screen.height+'x'+screen.colorDepth +'&amp;z='+Math.random() +'&amp;ref='+escape(document.referrer.substr(0,255)) +'&amp;uri='+escape(document.URL.substr(0,255));document.write('<ifr'+'ame width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;zid=7681&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank'+q+'" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0"></ifr'+'ame>');
	]]></script>
        <noscript>
          <iframe width="468" height="60" src="http://g.adspeed.net/ad.php?do=html&amp;zid=7681&amp;oid=111&amp;wd=468&amp;ht=60&amp;target=_blank" frameborder="0" scrolling="no" allowtransparency="true" hspace="0" vspace="0">
            <a href="http://g.adspeed.net/ad.php?do=clk&amp;zid=7681&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" target="_blank">
              <img style="border:0px;max-width:100%;height:auto;" src="http://g.adspeed.net/ad.php?do=img&amp;zid=7681&amp;oid=111&amp;wd=468&amp;ht=60&amp;pair=as" alt="i" width="468" height="60"/>
            </a>
          </iframe>
        </noscript>
        <!-- AdSpeed.com End -->
      </ServingCode>
    </Zone>
  </Zones>
</Ad>

AS.Ad.getStats

Returns the stats for this ad. Limit 50 calls/day.
Parameters
  • ad Required
    The ad identification
  • token Required
    The authentication MD5 hash generated from concatenating [Ad ID][Ad Name]
  • metric Required
    The type of metric can be "impressions", "clicks", "revenue", or "expense"
  • period Required
    The breakdown period can be "hourly", "daily", "weekly", or "monthly"
Sample Request
Sample Response
<StatRows generated="[Time Stamp]" title="[Entity Name]">
  <StatRow>
    <Monthly>January 2014</Monthly>
    <Unique_Impression>3,156</Unique_Impression>
    <Gross_Impression>6,565</Gross_Impression>
    <Unique_over_Gross_Impression>48.07%</Unique_over_Gross_Impression>
  </StatRow>
  <StatRow>More Rows...</StatRow>
  <StatRow>
    <Monthly>Total</Monthly>
    <Unique_Impression>57,417</Unique_Impression>
    <Gross_Impression>114,979</Gross_Impression>
    <Unique_over_Gross_Impression>49.94%</Unique_over_Gross_Impression>
  </StatRow>
  <StatRow>
    <Monthly>Average</Monthly>
    <Unique_Impression>4,785</Unique_Impression>
    <Gross_Impression>9,582</Gross_Impression>
    <Unique_over_Gross_Impression>49.94%</Unique_over_Gross_Impression>
  </StatRow>
</StatRows>

Other Articles in AdSpeed API

Documentation to use AdSpeed API to integrate AdSpeed AdServer into your own platform.

Cannot find an answer for your question? Ask our Customer Care team

Related