Tags:
create new tag
view all tags

Question

I was hoping someone could answer some questions I have about the REST interface for twiki. (TWikiScripts )

I have created a small open source GUI that allows people to connect to a Trac wiki using XMLRPC and the Wiki RPC interface (http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2). This worked surprisingly well for me but we use TWiki for our corporate knowledge base and I need to make something for it.

So, anyway, I am trying to figure out how to use the REST interface to duplicate the functionality of the WikiRPC interface.

Can anyone point me at some code samples that show how to use the REST interface to TWiki to do things like:

  • retrieve a list of all pages
  • retrive the data of a page
  • submit a changed page
  • download and add attachments
  • get/set metadata for a page

Environment

TWiki version: TWikiRelease04x00x05
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: fedora core 6
Web server: Apache 2.0
Perl version:  
Client OS:  
Web Browser:  
Categories: Contributing code, Plugins, Add-Ons

-- TWikiGuest - 13 Jan 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Several people have been asking for better documentation of TWiki's REST interface. At this time, your best bet is to study the code of the EmptyPlugin, SVN:twikiplugins/EmptyPlugin/lib/TWiki/Plugins/EmptyPlugin.pm (see also HowToUseTWikiFuncGetCgiQuery question.)

After you figured it out, would you be interested in supporting the TWikiCommunity by writing a RestInterfaceCookbook as one of the SupplementalDocuments?

Once you have the rest part figured out you can use the TWikiFuncDotPm functions to interact with TWiki content.

An alternative to REST is to use CPAN:LWP::UserAgent to interact with TWiki on the http level. Study the BuildContrib code.

-- PeterThoeny - 14 Jan 2007

If I understand correctly then, there is no current external interface that would support capabilities similar to WikiRPC. If I need this then I would have to write my own plugin that implemented an interface callable through the REST interface of TWiki. Is this correct?

Unfortunately I don't have a detailed enough understanding of TWiki or the time to develop a plugin like this. I was really hoping that TWiki would already have something like this since several of its competitors provide these capabilities.

I think that for now I will just have our developers use our internal Trac-based sites when they want to use external tools for browsing and editing the content. Who knows though, maybe one of them or another TWiki user will be inspired enough to "scratch an itch" and add this support to TWiki in the future.

Thanks for your help.

-- TWikiGuest - 14 Jan 2007

Ah, may be you are looking for XmlRpcContrib that offers an XmlRpc interface. See also XmlRpcForWebApps.

FYI, even without REST and XML-RPC it is possible to do a lot with the standard TWiki variables. See the big list of TWikiVariables. Simply create utility pages with variables; if needed add URLPARAMs to variables so that you can drive the behaviour dynamically with URL parameters. Study WebRssBase and WebRss to get an idea how this works in the case of an RSS feed.

Other examples: VarWEBLIST returns the list of webs, VarTOPICLIST the list of topics in a web, respectively. For example, to get the list of all topics of a given web, create a utility topic with content:
%TOPICLIST{ web="%URLPARAM{web}%" }%
and access that topic with a web=Foobar parameter. You can format the output if needed. You can get the source of the topic text as plain text without any page decoration by appending a raw=all to the view URL. You can get the topic text including meta data by appending a raw=all.

-- PeterThoeny - 15 Jan 2007

Change status to:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-01-15 - 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.