Our social media and marketing system makes billions of images and other media available to our clients that can be immediately posted or scheduled to any number of social networks. Part of that content includes entertainment quotes, goofs, and trivia - all compiled from a number of sources. Our platform uses WordPress to query the entertainment data... and it's clumsy, cumbersome, and slow. As part of our longer-term plan of migrating the systems over to our new platform, we're moving to a very API-centric service... meaning that data will be more easily available outside of our web-based tools.
This article exists primarily for our current and former clients that have existing platform access and might choose to use the data.
The Result
The endpoint for all requests follows the following format: http://api.beliefmedia.com/platform/sources/cinema/{data-type}.json
, where {data-type} is either quotes
, trivia
, or goofs
. Required parameters for any search are type
(browse
, search
, or show
) and search
(search term or show slug). An API key is required.
The first example shows a search of the quotes data for the term "friends". A request to quotes.json?apikey=xxxxx&type=search&search=friends
returns JSON data that unfolds as follows:
To search a specific program, the type parameter is show
and the search parameter is the show's slug (details below). So, quotes.json?apikey=xxxxx&type=show&search=friends-1994
returns JSON data that unfolds into the following array.
To return details for a specific episode, use quotes.json?apikey=xxxxx&id=R6BAq
. Depending upon your access the returned data may return image templates to be used for image creation (the title_slug
field relates to the location of a directory with show templates).
It doesn't matter if you're returning quotes, trivia, or goofs, the returned array format remains the same.
Show List
To browse available programming, the endpoint of shows.json
should be used. Available parameters are page
, number
, and apikey
(the latter is required). The returned array includes a search
value that should be used (in quotes, trivia, and goof searches) to return only a specific program.
Sample PHP Functions
The following functions are examples only.
Search Quotes, Trivia, or Goofs
Return List of Programs
Considerations
- Adding
&csv=yes
to the request URL will return a CSV download. There are a number of other features but they're beyond the scope of this article. - A WordPress plugin is available to clients that will create a paginated resource in your WordPress blog. Simple Cache is required.
- The
data_version
displays the current version of data. It's expected you'll cache data locally... and using the version in your transient will ensure that you always have the most up-to-date results. - Post on automated quotes here. In most cases moving forward, we'll be using a single blurred background image rather than a random clear image. The last point we made in that article: "we urge our partners to select appropriate material that is consistent with their brand", remains as relevant today.
- From a social perspective, the search function permits relevant content to be sourced for sharing on various platforms. The mortgage sector, for example, might extract quotes on 'mortgages' or 'finance' and then use our image quote creation API to return a fully formatted image.
Featured Image: Ellen DeGeneres Oscar Tweet , 2nd March 2014.