Adding a Video Ad to an Ad Set

After you create an ad set, you can add as many videos as you like.

To add an ad to an ad set:

POST to the /v2/ad_set route with identifier of an ad set, the /ads qualifier, and the details of the video ad in the POST body. The following example creates an ad set and associates the 01M2F0MTr3SWBB9dfAPT5xEsg8Gpy asset from the user's own assets with it.
[POST]/v2/ad_sets/77506f70fc1e4b08805687980cc4a24d/ads{  
   "ads":[  
      {  
         "ad_source":"assets",
         "ad_type":"preroll",
         "embed_code":"01M2F0MTr3SWBB9dfAPT5xEsg8Gpy",
         "plays_before":0,
         "plays_between":1,
         "click_url":"http://www.myclickurl.com",
         "tracking_pixel_urls":[  
            "http://www.mytrackingpixel.com"
         ]
      }
   ]
}
The Backlot UI responds similarly to the following.
{  
   "name":"My new Ad Set",
   "id":"77506f70fc1e4b08805687980cc4a24d",
   "ads":[  
      {  
         "ad_source":"assets",
         "ad_type":"preroll",
         "embed_code":"01M2F0MTr3SWBB9dfAPT5xEsg8Gpy",
         "plays_before":0,
         "plays_between":1,
         "click_url":"http://www.myclickurl.com",
         "tracking_pixel_urls":[  
            "http://www.mytrackingpixel.com"
         ]
      }
   ]
}
Note:

Try out the code samples using your account credentials in the Ooyala Scratchpad. For information about using the Scratchpad, see Practice Making Requests with the Scratchpad. To launch the scratchpad, go to Ooyala API Scratchpad.

Was this article helpful?