Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 5.0.0
-
Fix Version/s: 5.4.0-b1
-
Component/s: Staff Interface
-
Labels:None
Description
Add support for Javascript Data Feeds. Data feeds allow package pricing, names, descriptions, and possibly other data to be easily embedded in an external website.
Staff UI
A feed should be enabled in the settings. Under Settings > Company add a new section called "Data Feeds" using the FontAwesome icon "fas fa-rss fa-fw"
There should be 1 links under Feeds, "Feed Settings". On this page, we should have a checkbox to enable or disable each feed, and an example of the code required to embed the feed that a user can copy/paste into their website.
I think we should default to no permissions for the feed, and if a feed is called we would return a message that says "This data feed is disabled, to enable visit Settings > Company > Feeds in the staff area."
We would actually return this from the URL called though, so that with the embed code it is actually output to the browser:
document.write('This data feed is disabled, to enable visit Settings > Company > Feeds in the staff area.');
URLs
This doesn't matter so much, but it would be ideal if feeds started with /feed/ in the URI, and good if this route can be changed if desired. So a feed URL would look something like
/feed/feedtype/?parameter1=value¶meter2=value
Feeds
- Package Name
- Package Description
- Package Pricing
- Client Count
- Domain Pricing (HTML table including all configured TLDs and their new, renew, transfer prices)
Example URLs for each with possible parameters
Package Name
Get the name of Package ID 1, in English
/feed/packages/packageid=1&lang=en_us&get=name
Package Description
Get the description of Package ID 1, in English, return HTML version
/feed/packages/packageid=1&lang=en_us&format=html&get=description
Package Pricing
Get the price of Pricing ID 1. Price is the normal price, Renewal Price, Transfer Price, Setup Fee, and Cancellation Fee should also be options, as well as currency, term, and period
/feed/packages/pricingid=1&get=price
Client Count
Return the number of clients of a particular status, default to "Active".
Domain Pricing
This one would require a little more work and be output in a table form that could be styled. I don't think we would necessarily have to use the domain manager, but it's possible that the domain manager would need to implement this feed. Requires more details.
Calling these URLs should return the value inside document.write(); and would be embedded into an HTML page like so:
<script language="javascript" src="http://account.domain.com/feed/packages/packageid=1&lang=en_us&format=html&get=description"></script>
We may want to consider some caching mechanism for this, as it could generate a large number of requests to Blesta and overwhelm MySQL.