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/053a4218-87c1-491d-83ac-6136abf0a866/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" ,
     "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.
  • ContentPartenrRuleBean
    {
     "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 Ooyala Pulse Audience Management functionality and you do not have an audience data integration added for your account.
    {
     "segmentId": "<audience segment ID>[<index>]<value>",
     "segmentName": "<audience segment name>:<value name>",  (Setting this value is ignored)
     "ruleType": "ALL_OF" | "AT_LEAST_ONE_OF" | "NONE_OF"
      }

Example:

Request header:

PUT /api/2.0/targeting-template/053a4218-87c1-491d-83ac-6136abf0a866/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": "124",
      "locationType": "COUNTRY",
      "locationName": "canada",
      "access": "ALLOW"
    },
    {
      "locationId": "840",
      "locationType": "COUNTRY",
      "locationName": "united states",
      "access": "ALLOW"
    }
  ],
  "tagAndPartnerRules": [
    {
      "resourceType": "TAG",
      "ruleType": "NONE_OF",
      "tag": "violence"
    }
  ],
  "categoryRules": [
    {
      "categoryId": "4d4ca496-4bd7-45a1-ae97-fa83a0e3faa3",
      "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": [
        "SUNDAY",
        "SATURDAY"
      ],
      "fromHour": 0,
      "fromMinute": 0,
      "toHour": 23,
      "toMinute": 59
    }
  ],
  "frequencyRules": [
    {
      "impressions": 5,
      "timeUnit": "CAMPAIGN_LIFETIME"
    }
  ],
  "audienceRules": {
    "4b621d55-219e-414b-abd4-045b23f69fa8": [
      {
        "segmentId": "4b621d55-219e-414b-abd4-045b23f69fa8[0]=2",
        "segmentName": "Gender:Female",
        "ruleType": "ALL_OF"
      },
      {
        "segmentId": "4b621d55-219e-414b-abd4-045b23f69fa8[1]=2",
        "segmentName": "Age:16-21",
        "ruleType": "ALL_OF"
      },
      {
        "segmentId": "4b621d55-219e-414b-abd4-045b23f69fa8[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/053a4218-87c1-491d-83ac-6136abf0a866/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)

해당 내용이 도움 되었습니까?