Browse Bundles

Each application using the Wurl API has access to curated selections of video Series named "Bundles". Developers often use Bundles to create a guide that allows users to browse by category (Bundle). Our API makes it easy to create an app to:

  1. Browse Bundles
  2. Drill down to browse the Series in each Bundle
  3. Drill down further to review & play the video Episodes in each Series.

The steps below provide a sample of how to make API requests to build a simple guide in your application.

Prerequisites

To run through the following steps, you will need to have created an application and have an access token. The Getting Started Guide provides steps on how to do that.

Get the Bundles

The first step is to request the root url of the API.

https://api.wurl.com/api?format=json&access_token=YOUR_TOKEN
Setting the Authorization header in your http client relieves you of the need to constantly construct URLs to add the access token.

The response will contain a links array:

{
 ...
 "links": [
  {
   "rel": [
    "urn:x-resource:name:bundles"
   ],
   "href": "https://api.wurl.com/api/bundles"
  }
 ...
 ]
}

Your app should parse the JSON and iterate the links collection looking for the rel named bundles ("urn:x-resource:name:bundles").

Once you have found the bundles link, request the URL specified in the href attribute of the link.

https://api.wurl.com/api/bundles?format=json&access_token=YOUR_TOKEN

The response will contain an entities array that lists all the bundles you have available. The abbreviated response below shows an example bundle entity:

{
  "rel": [
    "urn:x-resource:schema:https://api.wurl.com/schemas/bundles.json"
  ],
  "class": [
    "bundles",
    "collection",
    "wurl-bundles"
  ],
  "entities": [
    {
      "rel": [
        "item",
        "urn:x-resource:name:bundle",
        "urn:x-resource:schema:https://api.wurl.com/schemas/bundle.json"
      ],
      "class": [
        "bundle",
        "wurl-bundle"
      ],
      "properties": {
        "id": 56,
        "title": "Featured Videos",
        "slug": "Featured_US",
        "description": "Featured series for US market",
        "primaryLanguage": "en",
        "category": "Mix",
        "totalItems": 15
      },
      "entities": [
        {
          "rel": [
            "top-series",
            "urn:x-resource:schema:https://api.wurl.com/schemas/series.json"
          ],
          "class": [
            "series",
            "wurl-series"
          ],
          "properties": {...}
          "entities": [...]
          "actions": [...]
          "links": [...]
        },
        {
          "rel": [
            "urn:x-resource:name:items",
            "bundle-items"
          ],
          "href": "https://api.wurl.com/api/bundles/56/items",
          "class": [
            "link",
            "collection",
            "bundle-items",
            "wurl-bundle-items"
          ]
        }
      ],
      "links": [
        {
          "rel": [
            "self"
          ],
          "href": "https://api.wurl.com/api/bundles/56"
        },
        {
          "rel": [
            "up"
          ],
          "href": "https://api.wurl.com/api/bundles"
        }
      ]
    },
  ],
  "links": [
    {
      "rel": [
        "self"
      ],
      "href": "https://api.wurl.com/api/bundles"
    },
    {
      "rel": [
        "up"
      ],
      "href": "https://api.wurl.com/api"
    }
  ]
}

As you iterate the entities collection of the bundles response, you can extract the title property of each bundle and use that for displaying a summary of the categories of content in your application's interface.

Drill into a Bundle

Let's chose to drill into and display the bundle displayed in the previous section's code sample.

The bundle entity contains it's own entities array. The entities array contains a few of the top series in the bundle as a sample of what the bundle contains. The entities array also contains an entity link to the items for the bundle. Search for the item in the entities array with the rel items ("urn:x-resource:name:items").

Since the items entity contains the href attribute, it is an Embedded Link Sub Entity. Extract the URL in the href attribute and request it:

https://api.wurl.com/api/bundles/56/items?format=json&access_token=YOUR_TOKEN

The items response is a collection of BundleItems. We list the first BundleItem below:

{
  "rel": [
    "urn:x-resource:schema:https://api.wurl.com/schemas/bundle_items.json"
  ],
  "class": [
    "bundle-items",
    "bundle_items",
    "collection",
    "wurl-bundle-items"
  ],
  "properties": {
    "bundleId": 56,
    "totalItems": 15,
    "currentCount": 15
  },
  "entities": [
    {
      "rel": [
        "bundle-item",
        "item",
        "urn:x-resource:name:bundle_item",
        "urn:x-resource:schema:https://api.wurl.com/schemas/bundle_item.json"
      ],
      "class": [
        "bundle_item",
        "wurl-bundle-item"
      ],
      "properties": {
        "id": 1980,
        "bundleId": 56,
        "position": 20
      },
      "entities": [
        {
          "rel": [
            "series",
            "urn:x-resource:name:series",
            "urn:x-resource:schema:https://api.wurl.com/schemas/series.json"
          ],
          "class": [
            "series",
            "wurl-series"
          ],
          "properties": {
            "id": 342903,
            "description": "The Worldwide Leader in Sports",
            "channelsRank": 83.9662798639226,
            "pubDate": "2014-01-15T09:31:35Z",
            "title": "ESPN",
            "thumbnails": {
              "default": {
                "url": "http://static0.channels.com/thumbnails/assets/youtube-com/feeds/167-2215/342903/Uploads-by-ESPN--jpg"
              }
            },
            "totalEpisodes": 2026,
            "matchesApp": true,
            "link": "http://www.youtube.com/channel/UCiWLfSweyRNmLpgEHekhoAg/videos"
           }
           ...
       }
       ...
    ]
  ...
}

Each bundle item contains a full embedded Series entity.

As you iterate the bundle item you will likely want to extract the series ("urn:x-resource:name:series") to display the title, thumbnail, and other properties for display in your application's interface.

Browse Bundles

Each application using the Wurl API has access to curated selections of video Series named "Bundles". Developers often use Bundles to create a guide that allows users to browse by category (Bundle). Our API makes it easy to create an app to:

  1. Browse Bundles
  2. Drill down to browse the Series in each Bundle
  3. Drill down further to review & play the video Episodes in each Series.

The steps below provide a sample of how to make API requests to build a simple guide in your application.

Prerequisites

To run through the following steps, you will need to have created an application and have an access token. The Getting Started Guide provides steps on how to do that.

Get the Bundles

The first step is to request the root url of the API.

https://api.wurl.com/api?format=json&access_token=YOUR_TOKEN
Setting the Authorization header in your http client relieves you of the need to constantly construct URLs to add the access token.

The response will contain a links array:

{
 ...
 "links": [
  {
   "rel": [
    "urn:x-resource:name:bundles"
   ],
   "href": "https://api.wurl.com/api/bundles"
  }
 ...
 ]
}

Your app should parse the JSON and iterate the links collection looking for the rel named bundles ("urn:x-resource:name:bundles").

Once you have found the bundles link, request the URL specified in the href attribute of the link.

https://api.wurl.com/api/bundles?format=json&access_token=YOUR_TOKEN

The response will contain an entities array that lists all the bundles you have available. The abbreviated response below shows an example bundle entity:

{
  "rel": [
    "urn:x-resource:schema:https://api.wurl.com/schemas/bundles.json"
  ],
  "class": [
    "bundles",
    "collection",
    "wurl-bundles"
  ],
  "entities": [
    {
      "rel": [
        "item",
        "urn:x-resource:name:bundle",
        "urn:x-resource:schema:https://api.wurl.com/schemas/bundle.json"
      ],
      "class": [
        "bundle",
        "wurl-bundle"
      ],
      "properties": {
        "id": 56,
        "title": "Featured Videos",
        "slug": "Featured_US",
        "description": "Featured series for US market",
        "primaryLanguage": "en",
        "category": "Mix",
        "totalItems": 15
      },
      "entities": [
        {
          "rel": [
            "top-series",
            "urn:x-resource:schema:https://api.wurl.com/schemas/series.json"
          ],
          "class": [
            "series",
            "wurl-series"
          ],
          "properties": {...}
          "entities": [...]
          "actions": [...]
          "links": [...]
        },
        {
          "rel": [
            "urn:x-resource:name:items",
            "bundle-items"
          ],
          "href": "https://api.wurl.com/api/bundles/56/items",
          "class": [
            "link",
            "collection",
            "bundle-items",
            "wurl-bundle-items"
          ]
        }
      ],
      "links": [
        {
          "rel": [
            "self"
          ],
          "href": "https://api.wurl.com/api/bundles/56"
        },
        {
          "rel": [
            "up"
          ],
          "href": "https://api.wurl.com/api/bundles"
        }
      ]
    },
  ],
  "links": [
    {
      "rel": [
        "self"
      ],
      "href": "https://api.wurl.com/api/bundles"
    },
    {
      "rel": [
        "up"
      ],
      "href": "https://api.wurl.com/api"
    }
  ]
}

As you iterate the entities collection of the bundles response, you can extract the title property of each bundle and use that for displaying a summary of the categories of content in your application's interface.

Drill into a Bundle

Let's chose to drill into and display the bundle displayed in the previous section's code sample.

The bundle entity contains it's own entities array. The entities array contains a few of the top series in the bundle as a sample of what the bundle contains. The entities array also contains an entity link to the items for the bundle. Search for the item in the entities array with the rel items ("urn:x-resource:name:items").

Since the items entity contains the href attribute, it is an Embedded Link Sub Entity. Extract the URL in the href attribute and request it:

https://api.wurl.com/api/bundles/56/items?format=json&access_token=YOUR_TOKEN

The items response is a collection of BundleItems. We list the first BundleItem below:

{
  "rel": [
    "urn:x-resource:schema:https://api.wurl.com/schemas/bundle_items.json"
  ],
  "class": [
    "bundle-items",
    "bundle_items",
    "collection",
    "wurl-bundle-items"
  ],
  "properties": {
    "bundleId": 56,
    "totalItems": 15,
    "currentCount": 15
  },
  "entities": [
    {
      "rel": [
        "bundle-item",
        "item",
        "urn:x-resource:name:bundle_item",
        "urn:x-resource:schema:https://api.wurl.com/schemas/bundle_item.json"
      ],
      "class": [
        "bundle_item",
        "wurl-bundle-item"
      ],
      "properties": {
        "id": 1980,
        "bundleId": 56,
        "position": 20
      },
      "entities": [
        {
          "rel": [
            "series",
            "urn:x-resource:name:series",
            "urn:x-resource:schema:https://api.wurl.com/schemas/series.json"
          ],
          "class": [
            "series",
            "wurl-series"
          ],
          "properties": {
            "id": 342903,
            "description": "The Worldwide Leader in Sports",
            "channelsRank": 83.9662798639226,
            "pubDate": "2014-01-15T09:31:35Z",
            "title": "ESPN",
            "thumbnails": {
              "default": {
                "url": "http://static0.channels.com/thumbnails/assets/youtube-com/feeds/167-2215/342903/Uploads-by-ESPN--jpg"
              }
            },
            "totalEpisodes": 2026,
            "matchesApp": true,
            "link": "http://www.youtube.com/channel/UCiWLfSweyRNmLpgEHekhoAg/videos"
           }
           ...
       }
       ...
    ]
  ...
}

Each bundle item contains a full embedded Series entity.

As you iterate the bundle item you will likely want to extract the series ("urn:x-resource:name:series") to display the title, thumbnail, and other properties for display in your application's interface.