PeopleAggregator API: method peopleaggregator.listAds

Arguments | Return value | REST (XML) example | REST (JSON) example | XML-RPC example

Method: peopleaggregator.listAds

List advertisements to be shown on a given page

Arguments (see also Authentication)

If calling by XML-RPC, note that this method takes a single struct as input, with the following keys:

page_type

Type: enum
Page on which the ads are to be shown
Allowed values: homepage, user_public, group
Example: homepage
Default: homepage

Return value (see also Exceptions)

Type: hash

Attributes:

success

Type: boolean
true if the user has successfully been created, false on failure.
Example: True

msg

Type: string
Detailed response information
Example: User phil created successfully

ads

Type: array
An advertisement

Content of each item:

item

Type: hash

Attributes:

id

Type: string
Advertisement ID
Example: ad:123

title

Type: string
Advertisement title
Example: Priceless!

description

Type: string
Advertisement detail
Example: Some text describing the ad (or in the ad?) would go here, if I was more imaginative.

image

Type: hash
Image to be shown in advertisement.

Attributes:

url

Type: string
URL of image
Example: http://example.org/peepagg/files/ad_image.jpg

width

Type: int
Width of image
Example: 420

height

Type: int
Height of image
Example: 960

url

Type: string
URL to send the user to when the ad is clicked
Example: http://example.com/landing_page

javascript

Type: string
Advertisement javascript
Example: alert('panic!')

orientation

Type: string
Horizontal, vertical position (with comma) of the ad module, as two integers
Example: 2,1

Example REST (XML) request

Request

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 1021

<response>
 <msg>User phil created successfully</msg>
 <ads>
  <item>
   <description>Some text describing the ad (or in the ad?) would go here, if I was more imaginative.</description>
   <title>Priceless!</title>
   <url>http://example.com/landing_page</url>
   <image>
    <url>http://example.org/peepagg/files/ad_image.jpg</url>
    <width>420</width>
    <height>960</height>
   </image>
   <javascript>alert('panic!')</javascript>
   <id>ad:123</id>
   <orientation>2,1</orientation>
  </item>
 </ads>
 <success>true</success>
</response>

Example REST (JSON) request

Request

Response

HTTP/1.1 200 OK
Content-Type: application/x-javascript
Content-Length: 405

{"msg": "User phil created successfully", "ads": [{"description": "Some text describing the ad (or in the ad?) would go here, if I was more imaginative.", "title": "Priceless!", "url": "http://example.com/landing_page", "image": {"url": "http://example.org/peepagg/files/ad_image.jpg", "width": 420, "height": 960}, "javascript": "alert('panic!')", "id": "ad:123", "orientation": "2,1"}], "success": true}

Example XML-RPC call

Request

POST /api/xmlrpc HTTP/1.1
Content-Type: text/xml
Content-Length: 704

<?xml version='1.0'?>
 <methodCall>
  <methodName>peopleaggregator.listAds</methodName>
  <params>
   <param>
    <value><struct>
     <member>
      <name>page_type</name>
      <value><string>homepage</string></value>
     </member>
    </struct></value>
   </param>
  </params>
 </methodCall>
 

Response

HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 5194

<?xml version='1.0'?>
 <methodResponse>
  <params>
   <param>
    <value><struct>
     <member>
      <name>msg</name>
      <value><string>User phil created successfully</string></value>
     </member>
     <member>
      <name>ads</name>
      <value><array><data>
       <value><struct>
        <member>
         <name>description</name>
         <value><string>Some text describing the ad (or in the ad?) would go here, if I was more imaginative.</string></value>
        </member>
        <member>
         <name>title</name>
         <value><string>Priceless!</string></value>
        </member>
        <member>
         <name>url</name>
         <value><string>http://example.com/landing_page</string></value>
        </member>
        <member>
         <name>image</name>
         <value><struct>
          <member>
           <name>url</name>
           <value><string>http://example.org/peepagg/files/ad_image.jpg</string></value>
          </member>
          <member>
           <name>width</name>
           <value><int>420</int></value>
          </member>
          <member>
           <name>height</name>
           <value><int>960</int></value>
          </member>
         </struct></value>
        </member>
        <member>
         <name>javascript</name>
         <value><string>alert('panic!')</string></value>
        </member>
        <member>
         <name>id</name>
         <value><string>ad:123</string></value>
        </member>
        <member>
         <name>orientation</name>
         <value><string>2,1</string></value>
        </member>
       </struct></value>
      </data></array></value>
     </member>
     <member>
      <name>success</name>
      <value><boolean>1</boolean></value>
     </member>
    </struct></value>
   </param>
  </params>
 </methodResponse>