smurfynet, on 04 March 2013 - 01:23 PM, said:
Prefomatted API Version
What would greatly simplify the task would be to have a "Text" or "HTML" format along with the "xml" and "json" data types.
The HTML type would return a preformatted output which contained summary information for the 'mech and a link to the 'mech in the mechlab.
I'm envisioning a format like this:
Quote
Chassis: HBK-4SP (Hunchback)
Armor: 304
Cooling Effeciency: 48%
Engine: STD ENGINE 255
Speed: 82.6 kph / 90.9 kph
Heatsinks: 16
Armaments
SRM 6 - Qty 2
MEDIUM LASER - Qty 4
Ammunition
SRM AMMO 300
Upgrades
Armor: Standard
Structure: Endo-Steel
Heatsinks: Double
Guidance: Standard
View Full Loudout
The idea is that the API returns preformatted HTML for a given Loadout ID. This makes it trivial to parse for BBCode - all the code needs to do is submit an API request for the linked Loadout ID and display the returned HTML inline.
You already have this information - I just cut and pasted it off the site and dropped it into some simple formatting.
You could potentially have multiple output formats (html_short, html_long) with more or less informaton, although I suspect the above would be sufficient for most.
The key is that no-one had to write a json or xml parser to render your data. That would be ugly and potentially break anytime you made changes to the data format. Instead, take full responsibility for generating as generic a template as possible for displaying the HTML.
There is some potential for some nifty in-line styling as well.
Iframe Version
The alternative would be to have a super simple display format similar to what I list above ON the smurfy site and allow it to be embedded as an iframe. That would be even simpler and give you greater control over the way the information is displayed. There is slightly more overhead for your servers (since you have to serve headers, etc.), but less overhead for the forum server.
Bottom Line
I could write the PHP to do ether of these methods in just a few lines of code. The API method is slightly harder, since you have to make a CURL call. The iframe is like a regex and building a string. YouTube does it the iframe way to great effect.