Plugin Web Service | |
Introduced in Tiki3 and improved in Tiki22 Use this wiki plugin to pull data from any JSON or SOAP enabled web service, e.g. those from Yahoo, or opendata portals based on CKAN. |
Parameters | |||||||||||||||||||||||||||||||||||
Display remote information exposed in JSON or YAML or SOAP XML Introduced in Tiki 3. Go to the source code Preferences required: wikiplugin_webservice
|
Examples | |
Plugin Image File is not an image.
And even change the output format by defining the format in a block after the tag:
|
1.1. Why | |
Some good examples of this are:
For a list of some of the web based information sources available have a look at, put URL here. |
1.2. How | |
There are multiple ways to display the information are supported, with various security and portability concerns.
The web service plugin is disabled by default. Also it is marked as unsafe, which means any use or modification requires validation by an administrator or a moderator with the required privileges. |
1.3. Output types | |
The output can generate:
The most basic, and safest, way to display is to use Smarty templates to generate wiki syntax but using Smarty to generate HTML affords more flexibility. |
1.4. Hello, World: Yahoo's Madonna Example | |
The following is the result set from the Madonna example on http://developer.yahoo.com/javascript/json.html Yahoo's Madonna Example Copy to clipboard
Copy to clipboard
|
1.5. Hello World: another example | |
Yahoo's Weather Forecast Copy to clipboard
Decoding JSON Use an online JSON editor like this one to understand the structure of the JSON data.
If all is well with your installation, the following should display as below it: Copy to clipboard
|
The data displayed live | |
no longer working {WEBSERVICE(url="https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json")} {{$response.query.results.channel.item.title}} {FANCYTABLE(head="Date|Day|High|Low")} {{foreach from=$response.query.results.channel.item.forecast item=result}} {{$result.date}}|{{$result.day}}|{{$result.high}}|{{$result.low}} {{/foreach}} {FANCYTABLE} {WEBSERVICE} |
1.6. Fuller Example | |
Note: this isn't such a good example because it doesn't work out of the box: you'll have to find your own bugzilla instance. Copy to clipboard
|
1.7. Registering a Webservice | |
To use higher capabilities, such as HTML generation, a web service must be registered. A registered web service contains:
A template contains:
When the output of Smarty is Tiki syntax, Smarty elements use double curly braces rather than single ones to avoid conflicts with the syntax. To register web services, visit tiki-admin.php?page=webservices on your tiki installation.(this is also where you define the body of the template used, you cannot reference an allready defined content template)
Copy to clipboard
|
1.8. Bundling the webservice in a Plugin Alias | |
A Plugin Alias can be created to hide complexity by making the web service aspects transparent. The end user sees it as a normal plugin but internally, it's only a reserved name. When encountered, the parameters provided to it are forwarded to an other plugin. Default values can be provided in the process. For example, a BUGZILLA plugin could be created to access the bug information. This plugin would:
Copy to clipboard
To register plugin aliases, visit tiki-admin.php?page=plugins on your tiki installation.
|
1.9. Implementation notes | |
|
1.10. Security | |
The webservice strategy mitigates this risk by applying an age-old concept: separate data from presentation. The web services only request the data from the remote host and nothing of the presentation aspects. The consumer side is responsible to display the information using their preferred display method. In the case of Tiki, Smarty is default option. Before being sent to the template engine, the received data is filtered to avoid XSS coming from the data. The presentation layer is assumed to be audited and safe. |
1.11. Presentation Suggestion | |
The templates are to be provided as part of the body under the _template property. The webservice registry presents the suggestions proposed by the remote hosts. These suggestions can be registered as valid templates. |
1.12. Related | |
|
Aliases | |