Goal Rules Requests

Note: There is a version 2 of the Goal Rules REST API endpoint. This endpoint complements the Goal API but it uses a different base URL and communication format. Capping the maximum number of impressions per 15 minutes, 30 minutes, and goal lifetime is only supported in version 2. For more information, refer to Goal Rules v2 Requests.

Getting Started

  • Base URL: https://api.videoplaza.com/api/1.0/goal/rule.
  • Requests: GET and PUT requests are used. You pass parameters by using common REST parameters like PATH, QUERY, and MATRIX, as well as HTTP HEADERS. The body of the requests should be provided in XML format and encoded using UTF-8.
  • Responses: All responses contain an HTTP status code in the header and the body is in XML format.
  • Related user documentation: Targeting Rules
The Goal Rules endpoint allows you to:

List Goal Rules by Goal ID

Method GET
URL https://api.videoplaza.com/api/1.0/goal/rule/by_goal_id
Header Authentication header (x-o-api-key)
Content type application/xml
Matrix params id: goal ID
Query params -
Body -
Success response

HTTP status: 200 OK

Header: -

Body: rulesBean

Example:

Request header:

GET /api/1.0/goal/rule/by_goal_id;id=2b0d9c09-4256-448c-af54-a9d36596e5fb HTTP/1.1
Host: api.videoplaza.com
Content-type: application/xml
x-o-api-key="<your key>"

Request body: NA

Success response:

HTTP status:
  200 (OK)

Body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rulesBean>
    <content>
        <resourceId>0d828b6b-5753-47a9-9a72-8639765193b3</resourceId>
        <resourceName>News</resourceName>
        <ruleType>ALL_OF</ruleType>
        <variableType>SITE</variableType>
    </content>
    <ignoreParentContentRules>false</ignoreParentContentRules>
    <ignoreParentFrequencyRules>false</ignoreParentFrequencyRules>
    <ignoreParentLocationRules>false</ignoreParentLocationRules>
    <ignoreParentTagRules>false</ignoreParentTagRules>
    <ignoreParentTimeRules>false</ignoreParentTimeRules>
    <locations>
        <allowed>true</allowed>
        <country>finland</country>
        <id>246</id>
        <iso2>fi</iso2>
        <locationType>COUNTRY</locationType>
    </locations>
    <parentId>2b0d9c09-4256-448c-af54-a9d36596e5fb</parentId>
</rulesBean>

Update Goal Rules

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

<rulesBean>
    <parentId>string</parentId>    <!-- Goal id -->
    <content>
        <resourceId>string</resourceId>    <!-- Category id/Content Partner id/Tag value -->
        <!-- <resourceName>string</resourceName> (Category/Content Partner/Tag name; setting this value is ignored) -->
        <ruleType>ALL_OF|AT_LEAST_ONE_OF|NONE_OF</ruleType>
        <variableType>CONTENT_PARTNER|SITE|TAG</variableType>
    </content>
    <frequencyCappings>
        <impressions>integer</impressions>    <!-- Number of impressions to allow in this time period -->
        <timeUnit>HOUR|DAY|WEEK|MONTH</timeUnit>
    </frequencyCappings>
    <locations>
        <allowed>boolean</allowed>
        <!-- <country>string</country> (Name of the country; setting this value is ignored) -->
        <id>string</id>
        <iso2>string</iso2>
        <locationType>COUNTRY</locationType>
    </locations>
    <locations>
        <allowed>boolean</allowed>
        <!-- <region>string</region> (Name of the region; setting this value is ignored) -->
        <id>string</id>
        <iso2>string</iso2>
        <locationType>REGION</locationType>
    </locations>
    <locations>
        <allowed>boolean</allowed>
        <!-- <city>string</city> (Name of the city; setting this value is ignored) -->
        <id>string</id>    <!-- Location id -->
        <iso2>string</iso2>
        <locationType>CITY</locationType>
    </locations>
    <timeRestrictions>    <!-- Time restrictions should be specified in the site's time zone -->
        <active>boolean</active>
        <days>MONDAY|TUESDAY|WEDNESDAY|THURSDAY|FRIDAY|SATURDAY|SUNDAY</days>        
        <fromHour>0-23</fromHour>
        <fromMinute>0-59</fromMinute>
        <toHour>0-23</toHour>
        <toMinute>0-59</toMinute>
    </timeRestrictions>
    <tags>
        <resourceId>string</resourceId>    <!-- Category id/Content Partner id/Tag value -->
        <!-- <resourceName>string</resourceName> (Category/Content Partner/Tag name; setting this value is ignored) -->
        <ruleType>ALL_OF|AT_LEAST_ONE_OF|NONE_OF</ruleType>
        <variableType>CONTENT_PARTNER|SITE|TAG</variableType>
    </tags>
    <ignoreParentContentRules>boolean</ignoreParentContentRules>
    <ignoreParentFrequencyRules>boolean</ignoreParentFrequencyRules>
    <ignoreParentLocationRules>boolean</ignoreParentLocationRules>
    <ignoreParentTagRules>boolean</ignoreParentTagRules>
    <ignoreParentTimeRules>boolean</ignoreParentTimeRules>
</rulesBean>
Note: The ignoreParentRules parameters can be set to:
  • true: override campaign targeting rules, meaning the goal applies its own targeting rules.
  • false: no targeting rules override, meaning the goal rules are merged with the parent rules.
For more information on targeting rules, refer to Targeting Rules Overview.
Method PUT
URL https://api.videoplaza.com/api/1.0/goal/rule/by_goal_id
Header Authentication header (x-o-api-key)
Content type application/xml
Matrix params id: goal ID
Query params -
Body Request Body Format
Success response

HTTP status: 204 No Content

Header: -

Body: -

Example:

Request header:

PUT /api/1.0/goal/rule/by_goal_id;id=2b0d9c09-4256-448c-af54-a9d36596e5fb HTTP/1.1
Host: api.videoplaza.com
Content-­type: application/xml
x-o-api-key="<your key>"

Request body:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rulesBean>
    <parentId>2b0d9c09-4256-448c-af54-a9d36596e5fb</parentId>
    <content>
        <resourceId>0d828b6b-5753-47a9-9a72-8639765193b3</resourceId>
        <resourceName>News</resourceName>
        <ruleType>ALL_OF</ruleType>
        <variableType>SITE</variableType>
    </content>
    <frequencyCappings>
        <impressions>3</impressions>
        <timeUnit>DAY</timeUnit>
    </frequencyCappings>
    <locations>
        <allowed>true</allowed>
        <country>finland</country>
        <id>246</id>
        <iso2>fi</iso2>
        <locationType>COUNTRY</locationType>
    </locations>  
    <tags>
        <resourceId>entertainment</resourceId>
        <resourceName>entertainment</resourceName>
        <ruleType>ALL_OF</ruleType>
        <variableType>TAG</variableType>
    </tags>
    <tags>
        <resourceId>interior</resourceId>
        <resourceName>interior</resourceName>
        <ruleType>ALL_OF</ruleType>
        <variableType>TAG</variableType>
    </tags>
    <timeRestrictions>
        <active>true</active>
        <days>SUNDAY</days>
        <days>MONDAY</days>
        <days>TUESDAY</days>
        <days>WEDNESDAY</days>
        <days>THURSDAY</days>
        <days>FRIDAY</days>
        <days>SATURDAY</days>
        <fromHour>0</fromHour>
        <fromMinute>0</fromMinute>
        <toHour>23</toHour>
        <toMinute>59</toMinute>
    </timeRestrictions>
    <ignoreParentContentRules>true</ignoreParentContentRules>
    <ignoreParentFrequencyRules>true</ignoreParentFrequencyRules>
    <ignoreParentLocationRules>true</ignoreParentLocationRules>
    <ignoreParentTagRules>true</ignoreParentTagRules>
    <ignoreParentTimeRules>true</ignoreParentTimeRules>   
</rulesBean>

Success response:

HTTP status:
  204 (No Content)

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