Tags:
automation2Add my vote for this tag rest2Add my vote for this tag structured_wiki2Add my vote for this tag web_application2Add my vote for this tag web_services2Add my vote for this tag create new tag
, view all tags

ConnectByRestPlugin

This plugin wraps functions from the TWiki API in REST functions. The intention is to offer external applications access to TWiki by implementing a REST interface.

The functions of this plugin include:

  • create and update topics
  • read topics and meta data
  • read and update form fields of a topic

The intention is to enable other web based applications to connect to TWiki. By calling the REST functions of this plugins applications can read, change or create topics in TWiki.

Topic content sent to the plugin for update or creation has to obey TWiki syntax - especially when providing special meta data like form fields, permissions, etc.

Calling the REST functions always requires successful authorization.

REST Functions

Function Readtopic

Description

This function returns the content of a topic as a string. It reads the topic that was specified in the parameter topic and returns the topic text as a string.

Parameters

Parameter Direction Type Description
username in string  
password in string  
topic in string use full topic name: web.topic
text out string topic text

Security

  • The function checks if the given user has read access to the topic.

Function Getmetastring

Description

This function returns the meta data of a topic as a string. It reads the topic that was specified in the parameter topic and uses the stringify method of the Meta-Object to return the complete meta data as a string

Parameters

Parameter Direction Type Description
username in string  
password in string  
topic in string use full topic name: web.topic
metastring out string full meta data

Security

  • The function checks if the given user has read access to the topic.

Function Updateformfield

Description

The function updates a single form field attached to a topic.

Parameters

Parameter Direction Type Description
username in string  
password in string  
topic in string use full topic name: web.topic
formfield in string form field name
newval in string new form field value

Security

  • The functions checks if the given user has write access to the topic.

Function Savetopic

Description

The function creates a new topic or updates an existing topic in the specified web.

Parameters

Parameter Direction Type Description
username in string  
password in string  
topic in string name of the new topic; use full topic name: web.topic
text in string topic content, including meta data

Security

  • The functions checks if the given user has write access to the web.

Syntax Rules

Examples

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %NEWPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Call TWiki API functions via REST calls

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

  • Download the ZIP file from the Plugin Home (see below)
  • Unzip ConnectByRestPlugin.zip in your twiki installation directory. Content:
File: Description:
data/TWiki/ConnectByRestPlugin.txt Plugin topic
lib/TWiki/Plugins/ConnectByRestPlugin.pm Plugin Perl module
data/Sandbox/ConnectByRestPluginTest.txt Plugin test topic

  • Configure the Plugin:
    • TWiki 4.0 and up: Run the configure script to enable the Plugin
    • Change the Plugin settings as needed
  • Test if the installation was successful:
    • enter samples here

Plugin Info

  • One line description
    • Set SHORTDESCRIPTION = Call TWiki API functions via TWiki REST functions.

Plugin Author: TWiki:Main/MichaelGulitz
Copyright: 2011, TWiki:Main/MichaelGulitz
License: GPL (GNU General Public License)
Plugin Version: 2012-12-17 (V1.000)
Change History:
2012-12-17: Update Comment regarding DatePickerPlugin
2010-05-05: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
Benchmarks: GoodStyle nn%, FormattedSearch nn%, ConnectByRestPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/ConnectByRestPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/ConnectByRestPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/ConnectByRestPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 ConnectByRestPlugin.md5 r3 r2 r1 manage 0.2 K 2012-12-17 - 12:41 MichaelGulitz  
Compressed Zip archivetgz ConnectByRestPlugin.tgz r3 r2 r1 manage 13.2 K 2012-12-17 - 12:41 MichaelGulitz  
Compressed Zip archivezip ConnectByRestPlugin.zip r3 r2 r1 manage 15.5 K 2012-12-17 - 12:41 MichaelGulitz  
Unknown file formatEXT ConnectByRestPlugin_installer r1 manage 3.5 K 2012-12-17 - 12:41 MichaelGulitz  
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2013-10-16 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.