Ad Rotators Items

    List all items of an ad rotator

    Get all the items of an ad rotator.

    Request

    • Method: GET
    • Version: v3, this API call supports additional sort and filter mechanisms as well as retrieving only a sub-set of fields

      Note: In order to access the v3 API endpoints please make sure you have enabled the new rendering engine.

    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /webresources/api/v3/sites/current/adrotators/[adrotator_ID]/items
      • Alternatively, use siteID instead of 'current'
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.

    Response body

    An array of the first 10 items; each object has the following properties:

    • id - ad rotator item ID (number)
    • adRotatorId - ad rotator ID (number)
    • siteId - site ID (number)
    • itemTypeId - item type ID (number)
      • 1 - Image
      • 2 - Flash
      • 3 - HTML
    • itemName - item's name/label (string)
    • itemUrl - item's click-through URL (string)
    • itemSource - item's source URL or HTML depending on the item's type (string)
    • itemTargetFrame - item's target frame (string)
    • itemWidth - item width (string)
    • itemHeight - item height (string)
    • itemUrl - item's source URL (string)
    • releaseDate - item's release date (dateTime)
    • expiryDate - item's expiry date (dateTime)
    • enabled - enabled (boolean)

    Accepts and returns JSON as Content-Type.


    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    
    var request = $.ajax({
        url: "/webresources/api/v3/sites/current/adrotators/4994/items",
        type: "GET",
        connection: "keep-alive",    
        contentType: "application/json",
        headers: {
            "Authorization": $.cookie('access_token')
        }
    });
    request.done(function (msg) {
        console.log(msg);
    });
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    });

    Sample response

    {
      "items": [
        {
          "id": 11995,
          "adRotatorId": 4994,
          "siteId": 1767665,
          "itemTypeId": 1,
          "itemName": "Image 1",
          "itemUrl": "https://my.affiliatelink.com/my-ad-page1",
          "itemSource": "http://placehold.it/350x150",
          "itemTargetFrame": "_blank",
          "itemWidth": "350px",
          "itemHeight": "150px",
          "releaseDate": "2016-03-15T00:00:00",
          "expiryDate": "9998-12-31T16:00:00",
          "enabled": true
        },
        {
          "id": 11996,
          "adRotatorId": 4994,
          "siteId": 1767665,
          "itemTypeId": 2,
          "itemName": "Flash 1",
          "itemUrl": "https://my.affiliatelink.com/my-ad-page2",
          "itemSource": "flash-url",
          "itemTargetFrame": "",
          "itemWidth": "",
          "itemHeight": "",
          "releaseDate": "2016-03-15T00:00:00",
          "expiryDate": "9998-12-31T16:00:00",
          "enabled": true
        },
        {
          "id": 11997,
          "adRotatorId": 4994,
          "siteId": 1767665,
          "itemTypeId": 3,
          "itemName": "HTML 1",
          "itemUrl": "https://my.affiliatelink.com/my-ad-page3",
          "itemSource": "<p>this is html</p>",
          "itemTargetFrame": "",
          "itemWidth": "",
          "itemHeight": "",
          "releaseDate": "2016-03-15T00:00:00",
          "expiryDate": "9998-12-31T16:00:00",
          "enabled": true
        },
        {
          "id": 11998,
          "adRotatorId": 4994,
          "siteId": 1767665,
          "itemTypeId": 1,
          "itemName": "Image 2",
          "itemUrl": "https://my.affiliatelink.com/my-ad-page4",
          "itemSource": "http://placehold.it/350x150",
          "itemTargetFrame": "self",
          "itemWidth": "350px",
          "itemHeight": "150px",
          "releaseDate": "2016-03-15T00:00:00",
          "expiryDate": "9998-12-31T16:00:00",
          "enabled": true
        }
      ],
      "totalItemsCount": 4,
      "skip": 0,
      "limit": 10
    }