In aggregating content to BeliefMedia as we retire old websites, we've had to put serious thought into how certain functionality was handled and maintained. One of the most significant features we were never happy with in the past was how downloads were handled. While there's a plethora of WordPress plugins available that'll handle file downloads in different ways, there weren't any that managed downloads the way we wanted them to. Back when we didn't have the time to create a solution ourselves, we settled on WP-Filebase - a relatively full featured WP plugin. However, the plugin hijacked the admin panel with the constant haggling to upgrade into a premium product, and it was notoriously unreliable and slow. Additionally, it was intrinsically connected to WordPress meaning there was no portability.
Note: This API endpoint is now retired. Another post will follow at some point that showcases the Platform Download Manager. The article is maintained as a reference only.
With a requirement to supply our clients with a customized full-featured and portable solution - and with a need to provide the service we want on our own site (in particular for downloads associated with our client marketing platform) - we built our own standalone file download application that seamlessly integrates with WordPress while maintaining platform autonomy. Partners can download a copy by logging into the client portal.
A small number of the features we included in our application are as follow.
- Version control. This permits a featured change log.
- Integration with plugins and shortcodes to render upgrade information on users' blogs.
- An API to display select information on all or individual downloads. API provides paginated responses.
- Ability to package the product up and supply it to clients.
- Caching to speed up responses.
- Client only, private, expiring, or password protected downloads.
- Daily reports are generated to measure the success of new products/downloads.
- Download RSS feeds.
- Track various details associated with each download by a user.
- Easy migration between platforms.
- Podcast integration.
- Reference downloads in WordPress with a single shortcode (the download links at the bottom of all our pages are created as follows
[download plugin="250" shortcode="251" php="252"]). Other file types are supported (.mp3, .pdf etc). A styled box will render with download links.
When additional features are required we'll simply build them in.
Our application makes an API available to return downloads in any number of ways. While the API data returned is minimal without an API key, basic information is available to anybody. Despite your likely lack of interest, what follows is a couple of basic examples (provided primarily for our clients that might require a similar feature).
Of course, WordPress itself provides a brilliant RESTful API, but we avoided integration simply so the application wasn't WordPress-dependent. Our system works with Joomla, Drupal, and any other application or CMS seamlessly.
http://api.beliefmedia.com/downloads/json.php [ Download ].
Without any URL parameters, the API returns all downloads as JSON data with basic information such as the title, description, version, and download link. Parameters for unregistered use are basic:
pg (current page),
num (number items), and
0 for date descending).
A simple PHP request to return the last 5 public downloads attached to published posts is as follows. Pagination information and other details are returned in the resulting array.
Displaying the latest downloads in WordPress can be accomplished with the following shortcode.
Available attributes for this sample shortcode are
cache. Usage is as follows:
- The API has made it easy to reference paginated lists of our articles that include downloads (Code, Plugins, Shortcodes, PHP Snippets).
- We can now provide product upgrade notices without having to link into WP's system. We do this by defining a product key in each plugin. The function we use will compare the returned version against that which is defined in the product. If the plugin is out of date, we'll render a banner or notice in the WP dashboard.
- Clients that use the product can use the application to render new or revised downloads or product updates on their website, Intranet, or WP control panel.
- The API is new. Please report errors.
- When we write code for a client, those client-protected downloads are available from the portal. The same update features apply.
- When a download includes a YouTube tutorial or video introduction, the TY video ID will be provided in the response.
- If you're a finance or real-estate partner, this is the same system used to deliver bank information downloads.