Assigning Publishing Rules to Assets

After you add an asset to Backlot, you can assign publishing rules that affect when and where the content can be played.

Note: When you first create a remote asset with POST, do not include the time_retsrictions property in the initial POST. The remote asset must first be created so that the embed code (content ID or asset ID) exists in the Ooyala system. After you have received the returned embed code for the asset, then you can use PUT with time_retsrictions. See an example in Adding an External ID to an Existing Asset.

For information about setting up publishing rules, see Publishing Rules.

To work with a publishing rules and assets:

  1. Assign a rule using a PUT with the /v2/assets route, the asset ID, and the /publishing_rules qualifier. The following example adds the 79feefbe24d9424786 publishing rule to the Y1dTdvMjq9QtOM asset:
    [PUT]/v2/assets/Y1dTdvMjq9QtOM/publishing_rule/79feefbe24d9424786

    Backlot returns a 200 response.

    Note:

    Try out the code samples using your account credentials in the Ooyala Scratchpad. For information about using the Scratchpad, see The Scratchpad.

  2. To verify that the publishing rule was added, use GET with the /v2/assets route, the asset ID, and the /publishing_rules qualifier. The following example gets the publishing rule for the asset with the Y1dTdvMjq9QtOM ID:
    [GET]/v2/assets/Y1dTdvMjq9QtOM/publishing_rule

    Backlot returns the details of the publishing rule. In this example, the rule allows playback on desktops/notebooks, at any time, from any domain, in the US and Great Britain:

    {  
       "name":"My Publishing Rule",
       "allowed_devices":[  
          "desktop"
       ],
       "time_restrictions":{  
          "start_date":"2007-04-05T00:00:00+00:00",
          "type":"range",
          "end_date":null
       },
       "domain_restrictions":{  
          "domains":[  
    
          ],
          "type":"blacklist"
       },
       "geographic_restrictions":{  
          "type":"whitelist",
          "locations":[  
             "GB",
             "US"
          ]
       },
       "id":"79feefbe24d9424786"
    }
    Note:

    Try out the code samples using your account credentials in the Ooyala Scratchpad. For information about using the Scratchpad, see The Scratchpad.

  3. To remove a publishing rule from an asset, use DELETE with the /v2/assets route, the asset ID, the /publishing_rule qualifier, and a label ID.
    Note: To permanently delete a publishing rule and remove it from all assets, see http://support.ooyala.com/documentation/users/label_delete.html.

    The following example deletes the 79feefbe24d9424786 publishing rule from the JxbzdkMjqBEsO asset.

    [DELETE]/v2/assets/JxbzdkMjqBEsO/labels/

    Backlot returns a 200 response.

    Note:

    Try out the code samples using your account credentials in the Ooyala Scratchpad. For information about using the Scratchpad, see The Scratchpad.

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