Targeting Template Rules Requests

Get Targeting Template Rules

Method GET
URL https://api.videoplaza.com/api/2.0/targeting-template/{id}/rules
Header Authentication header (x-o-api-key)
Content type application/json
URL params ID of the targeting template
Query params -
Body -
Success response

HTTP status: 200 OK

Header: -

Body:

{
  "locationRules": [],
  "tagAndPartnerRules": [],
  "categoryRules": [],
  "ipRules": [],
  "userAgentRules": [],
  "timeRules": [],
  "frequencyRules": [],
  "audienceRules": {}
}

Example:

Request header:

GET /api/2.0/targeting-template/53b9389e-2ffe-43d0-b3bd-72ffb1a84fd6/rules HTTP/1.1
Host: api.videoplaza.com
Content-­type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
    200 (OK)

Body:
{
  "locationRules": [],
  "tagAndPartnerRules": [],
  "categoryRules": [],
  "ipRules": [],
  "userAgentRules": [],
  "timeRules": [],
  "frequencyRules": [
    {
      "impressions": 5,
      "timeUnit": "CAMPAIGN_LIFETIME"
    }
  ],
  "audienceRules": {}
}

Update Targeting Template Rules

Method PUT
URL https://api.videoplaza.com/api/2.0/targeting-template/{id}/rules
Header Authentication header (x-o-api-key)
Content type application/json
URL params ID of the targeting template
Query params -
Body
{
 "frequencyRules": [FrequencyRuleBean],
 "locationRules": [LocationRuleBean],
 "timeRules": [TimeRuleBean],
 "tagAndPartnerRules": [TagRuleBean or ContentPartnerRuleBean],
 "categoryRules": [CategoryRuleBean],
 "ipRules": [IpRuleBean],
 "userAgentRules": [UserAgentRuleBean],
 "audienceRules": {"<audience data provider id>": AudienceSegmentRuleBean} 
}
Success response

HTTP status: 204 No Content

Header: -

Body: -

Request Body Format

To update the rules of a targeting template, you need to supply a body to the request with the following format:

{
 "frequencyRules": [FrequencyRuleBean],
 "locationRules": [LocationRuleBean],
 "timeRules": [TimeRuleBean],
 "tagAndPartnerRules": [TagRuleBean or ContentPartnerRuleBean],
 "categoryRules": [CategoryRuleBean],
 "ipRules": [IpRuleBean],
 "userAgentRules": [UserAgentRuleBean],
 "audienceRules": {"<audience data provider id>": AudienceSegmentRuleBean} (Required only if you have an audience data integration added for your account)
  }
  • FrequencyRule Bean
    {
     "impressions": <number of impressions to allow in this time period>,
     "timeUnit": "QUARTER_HOUR" | "HALF_HOUR" | "HOUR" | "DAY" | "WEEK" | "MONTH" | "GOAL_LIFETIME" | "CAMPAIGN_LIFETIME"
      }
  • LocationRuleBean
     {
     "locationId": "<location id>",
     "locationType": "CITY" | "REGION" | "COUNTRY" | "METRO",
     "locationName": "Germany" | "Berlin" | ... ,    (Setting this value is ignored)
     "access": "ALLOW" | "DENY"
      }
  • TimeRuleBean
    {
     "active": true | false,
     "days": [ "MONDAY" | "TUESDAY" | "WEDNESDAY" | "THURSDAY" | "FRIDAY" | "SATURDAY" | "SUNDAY" ],
     "fromHour": 0 - 23,
     "fromMinute": 0 - 59,
     "toHour": 0 - 23,
     "toMinute": 0 - 59
      }
  • TagRuleBean
    {
     "tag": "<tag  value>",
     "resourceType": "TAG",
     "ruleType": "ALL_OF" | "AT_LEAST_ONE_OF" | "NONE_OF"
      }
    Note: When setting the tag rule to AT_LEAST_ONE_OF, you need to provide at least two tags using separate TagRuleBean.
  • ContentPartnerRuleBean
    {
     "partnerId": "<content partner ID>",
     "partnerName": "<content partner name>",  (Setting this value is ignored)
     "resourceType": "CONTENT_PARTNER",
     "ruleType": "ALL_OF" | "AT_LEAST_ONE_OF" | "NONE_OF"
      }
  • CategoryRuleBean
    {
     "categoryId": "<category ID>",
     "categoryName": "<category name>",  (Setting this value is ignored)
     "ruleType": "AT_LEAST_ONE_OF" | "NONE_OF"  ("ALL_OF" is not allowed for categories)
      }
  • IpRuleBean
    {
     "ipMatcher": "192.168.0.1" | "192.168.0.1-68" | "192.168.0.*",
     "access": "ALLOW" | "DENY"
      }
  • UserAgentRuleBean
    {
     "browsers": [ "IE" | "FIREFOX" | "CHROME" | "SAFARI" | "OPERA" | "OTHER" ],
     "operatingSystems": [ "WINDOWS" | "MACOSX" | "LINUX" | "IOS" | "ANDROID" | "OTHER" ],
     "access": "ALLOW" | "DENY"
      }
  • AudienceSegmentRuleBean
    Note: You can leave this part out if you are not using the Pulse Audience Management functionality and you do not have an audience data integration added for your account.
    {
     "segmentId": "<audience data provider ID>[<index>]=<value>",
     "segmentName": "<audience key label>:<audience value label>",  (Setting this value is ignored)
     "ruleType": "ALL_OF" | "AT_LEAST_ONE_OF" | "NONE_OF"
      }
    The information for the audience segments is found in these locations:
    • The audience data provider ID can be found through the Audience API.
    • The index, value, audience key label and audience value label must be retrieved from the Segment Identification Document that was provided to us when setting up the audience segments in Pulse.

Example:

Request header:

PUT /api/2.0/targeting-template/53b9389e-2ffe-43d0-b3bd-72ffb1a84fd6/rules HTTP/1.1
Host: api.videoplaza.com
x-o-api-key="<your key>"
Content-Type: application/json
Content-Length: 1713

Request body:

{
    "locationRules": [
        {
            "locationId": "34785",
            "locationType": "CITY",
            "locationName": "mumbai",
            "access": "ALLOW"
        },
        {
            "locationId": "356",
            "locationType": "COUNTRY",
            "locationName": "india",
            "access": "ALLOW"
        },
        {
            "locationId": "356002",
            "locationType": "METRO",
            "locationName": "mumbai metropolitan region",
            "access": "ALLOW"
        },
        {
            "locationId": "297",
            "locationType": "REGION",
            "locationName": "india",
            "access": "ALLOW"
        }
    ],
    "tagAndPartnerRules": [
        {
            "resourceType": "TAG",
            "ruleType": "NONE_OF",
            "tag": "violence"
        }
    ],
    "categoryRules": [
        {
            "categoryId": "dc74b090-c275-4646-a37f-4d5cff09997a",
            "categoryName": "Entertainment",
            "ruleType": "AT_LEAST_ONE_OF"
        }
    ],
    "ipRules": [
        {
            "ipMatcher": "192.168.0.1-68",
            "access": "ALLOW"
        }
    ],
    "userAgentRules": [
        {
            "access": "ALLOW",
            "browsers": [
                "FIREFOX",
                "CHROME"
            ],
            "operatingSystems": [
                "WINDOWS",
                "MACOSX"
            ]
        }
    ],
    "timeRules": [],
    "frequencyRules": [
        {
            "impressions": 5,
            "timeUnit": "CAMPAIGN_LIFETIME"
        }
    ],
    "audienceRules": {
        "7915b4ad-0572-4d88-bcf9-7f0813c953b3": [
            {
                "segmentId": "7915b4ad-0572-4d88-bcf9-7f0813c953b3[0]=2",
                "segmentName": "Gender:Female",
                "ruleType": "ALL_OF"
            },
            {
                "segmentId": "7915b4ad-0572-4d88-bcf9-7f0813c953b3[1]=2",
                "segmentName": "Age:16-21",
                "ruleType": "ALL_OF"
            },
            {
                "segmentId": "7915b4ad-0572-4d88-bcf9-7f0813c953b3[1]=3",
                "segmentName": "Age:21-29",
                "ruleType": "ALL_OF"
            }
        ]
    }
}

Success response:

HTTP status:
    204 (No Content)

Import Targeting Template Rules into Campaign or Goal

Method POST
URL https://api.videoplaza.com/api/2.0/targeting-template/{id}/import
Header Authentication header (x-o-api-key)
Content type application/json
URL params ID of the targeting template
Query params
  • campaignId: the ID of the campaign to import the rules to
  • goalId: the ID of the goal to import the rules to
Body -
Success response

HTTP status: 204 No Content

Header: -

Body: -

Example:

Request header:

POST /api/2.0/targeting-template/53b9389e-2ffe-43d0-b3bd-72ffb1a84fd6/import?campaignId=f7dacaa0-e3af-4f0e-b29d-87152a8c3cc5 HTTP/1.1
Host: api.videoplaza.com
Content-Type: application/json
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
    204 (No Content)