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": {},
  "accountCustomParameterRules": {}
}

Example:

Request header:

GET /api/2.0/targeting-template/108cd725-9200-42fd-89de-057ab9b77733/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": "DAY"
        }
    ],
    "accountCustomParameterRules": {
        "acp.genre": [
            {
                "value": "Comedy",
                "ruleType": "AT_LEAST_ONE_OF"
            },
            {
                "value": "Romance",
                "ruleType": "AT_LEAST_ONE_OF"
            },
            {
                "value": "Horror",
                "ruleType": "NONE_OF"
            },
            {
                "value": "Thriller",
                "ruleType": "NONE_OF"
            }
        ],
        "acp.network": []
    },
    "audienceRules": {
        "7915b4ad-0572-4d88-bcf9-7f0813c953b3": []
    }
}

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 See Request Body Format for more information.
{
 "frequencyRules": [FrequencyRuleBean],
 "locationRules": [LocationRuleBean],
 "timeRules": [TimeRuleBean],
 "tagAndPartnerRules": [TagRuleBean or ContentPartnerRuleBean],
 "categoryRules": [CategoryRuleBean],
 "ipRules": [IpRuleBean],
 "userAgentRules": [UserAgentRuleBean],
 "audienceRules": {"<audience data provider id>": [AudienceSegmentRuleBean]},
 "accountCustomParameterRules": {"acp.paramName": [AccountCustomParameterRuleBean]} 
}
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)
 "accountCustomParameterRules": {"acp.paramName": [AccountCustomParameterRuleBean]}  (Required only if you have account custom parameters enabled and configured 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

    Time rules should be specified based on the account's time zone.

    {
     "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 provider integration added for your account.
    {
     "segmentId": "<audience data provider ID>[<segmentationId>]=<segmentId>",
     "segmentName": "<segmentationName>:<segmentName>",  (Setting this value is ignored)
     "ruleType": "ALL_OF" | "AT_LEAST_ONE_OF" | "NONE_OF"
      }

    The information for accurately constructing the AudienceSegmentRuleBean can be found through the Audience Management API.

    Note: If you have provided us with a Segment Identification Document when integrating, you may notice that the naming differs from the one used in the Audience Management API. See Data Integration Structure for more details on the different parameters, and their old and new naming.
  • AccountCustomParameterRuleBean
    Note: You can leave this part out if you are not using the Account Custom Parameter functionality and you do not have any account custom parameters defined for your account.
    {
      "value": "<string>",  (Value for the corresponding acp parameter defined for your Pulse account)
      "ruleType": "AT_LEAST_ONE_OF" | "NONE_OF" ("ALL_OF" is not allowed for account custom parameters)
    }
    Note:
    • You can add a maximum of 20 values for one account custom paramater.
    • The account custom parameter values cannot contain any spaces or any of the following characters: comma (,), semicolon (;), double quote/quotation mark ("), single quote/apostrophe ('), backslash (\), pipe (|), tilde (~), or ampersand (&).

Example:

Request header:

PUT /api/2.0/targeting-template/108cd725-9200-42fd-89de-057ab9b77733/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": [
        {
            "active": true,
            "days": [
 		 "SATURDAY",
 		 "SUNDAY"
 		 ],
            "fromHour": 0,
	     "fromMinute": 0,
	     "toHour": 23,
	     "toMinute": 59
	 }
    ],
    "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"
            }
        ]
    },
    "accountCustomParameterRules": {
        "acp.genre": [
            {
                "value": "Comedy",
                "ruleType": "AT_LEAST_ONE_OF"
            },
            {
                "value": "Romance",
                "ruleType": "AT_LEAST_ONE_OF"
            },
            {
                "value": "Horror",
                "ruleType": "NONE_OF"
            },
            {
                "value": "Thriller",
                "ruleType": "NONE_OF"
            }
        ],
        "acp.network": []
    }
}

Success response:

HTTP status:
    204 (No Content)

Import Targeting Template Rules into Campaign or Goal

This means that the rules from the template are copied to the campaign or goal. If you edit the template, the changes DO NOT AFFECT the campaign/goal targeting. Importing rules can be useful when you want to use the rules from a template, but still add some extra information manually.

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/108cd725-9200-42fd-89de-057ab9b77733/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)