Creating Publishing Rules

You can create as many publishing rules as you like and assign them to videos, channels, or channel sets. During playback, the most restrictive rule as applied.

To create a publishing rule:

Use the /v2/publishing_rule route. The following example creates the "My Publishing Rule" publishing rule which restricts viewing to the US and EU, restrict embedding to mywebsite.com, allows the content to be viewed on Mondays and Wednesdays, and allows the content to be played on desktops/notebooks and tablets.
[POST]/v2/publishing_rules{  
   "name":"My Publishing Rule",
   "geographic_restrictions":{  
      "type":"whitelist",
      "locations":[  
         "US",
         "EU"
      ]
   },
   "domain_restrictions":{  
      "type":"whitelist",
      "domains":[  
         "mywebsite.com"
      ]
   },
   "time_restrictions":{  
      "type":"recurring",
      "start_date":"2010-01-01",
      "end_date":null,
      "recurring_days":[  
         "MON",
         "WED"
      ],
      "all_day":false,
      "start_time":"20:00:00",
      "end_time":"23:59:00"
   },
   "allowed_devices":[  
      "desktop",
      "ipad",
      "android",
      "blackberry"
   ]
}

Backlot returns a response similar to the following.

{  
   "name":"My Awesome Publishing Rule",
   "allowed_devices":[  
      "desktop",
      "ipad",
      "android",
      "blackberry"
   ],
   "time_restrictions":{  
      "start_date":"2010-01-01",
      "end_time":"23:59:00",
      "recurring_days":[  
         "MON",
         "WED"
      ],
      "type":"recurring",
      "end_date":null,
      "all_day":false,
      "start_time":"20:00:00"
   },
   "domain_restrictions":{  
      "domains":[  
         "mywebsite.com"
      ],
      "type":"whitelist"
   },
   "geographic_restrictions":{  
      "type":"whitelist",
      "locations":[  
         "US",
         "EU"
      ]
   },
   "id":"5b3ff777724d46f"
}
Note: Try out the code samples using your account credentials in the Ooyala Scratchpad. To launch the Scratchpad, go to Ooyala API Scratchpad. For information about using the Scratchpad, see Practice Making Requests with the Scratchpad.

The publishing rule is successfully added.

Was this article helpful?