Add Parse JSON (from the Miscellaneous section of the palette).
Create a flow from the exit of Download URL to the <JSON Text> trigger of Parse JSON.
Add a Data Structure (from the Data Types section of the palette). Name it Top Trends DS.
Continue to use the Data Types section of the palette to model the structure of Top Trends DS as follows (name the elements exactly as shown, to match https://api.twitter.com/1/trends/1.js): ** Note: locations and trends are repetitive **Note: created_at and as_of should actually be of type Date and Time, but to avoid dealing with date and time formatting at this stage, and since we don't intend to make any use of them, we have defined them as Text elements.
Create a flow from the <Value> exit of Parse JSON to Top Trends DS.
Add an action Convert to Content Item (keyboard shortcut 'a'). Make it repetitive (keyboard shortcut 'r').
Add to Convert to Content Item a trigger (keyboard shortcut 't') and an exit (keyboard shortcut 'e').
Create a flow from Top Trends DS/trends to the trigger of Convert to Content Item. Note that a flow from a repetitive element (trends) to a trigger of a repetitive action (Convert to Content Item) means the action will be executed repetitively - once for each occurrence of trends.
Create a flow from the exit of Convert to Content Item to the repetitive exit (Parsed Data) of Get Top Trends.
The Get Top Trends service model now looks like this:
Model Convert to Content Item as follows:
Zoom into Convert to Content Item.
Right click the action's trigger and select Show in Repository Explorer. From the Repository Explorer drag and drop the trends data structure.
Create a flow from the trigger to trends.
In a similar manner, right click the action's exit and select Show in Repository Explorer. From the Repository Explorer drag and drop Twit. Create a flow from Twit to the exit.
Create a flow from trends/name to Twit/Title/<Value>.
Create a flow from trends/url to Twit/Details/<Value>.
Add a Text constant (from the Constants section of the palette). Set its value to Twitter48.png.
Create a flow from "Twitter48.png" to Twit/Thumbnail/<SRC>.
Convert to Content Item now looks like this:
Add the Image Twitter48.png to your project:
Switch to the Navigator view (Window -> Show View -> Navigator).
Download the image file http://downloads.tersus.com/Twitter48.png and copy it to the web folder of your project:
Save your changes (through the File->Save menu option, the CTRL+S shortcut, or the Savetoolbar button).
If you now switch back to your browser, it should automatically refresh and display the current trends: Online demo no longer working due to an API change of Twitter
Download Model: Stage 3 (version 2.1.9)
Next: Organizing the Navigation Bar
For best results, use the Firefox browser..