The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TiddlyWeb::Resting - module for accessing TiddlyWeb HTTP API

SYNOPSIS

  use TiddlyWeb::Resting;
  my $Rester = TiddlyWeb::Resting->new(
    username => $opts{username},
    password => $opts{password},
    server   => $opts{server},
  );
  $Rester->workspace('wikiname');
  $Rester->get_page('my_page');
}

DESCRIPTION

TiddlyWeb::Resting is a module designed to allow remote access to the TiddlyWeb API for use in Perl programs. It is a work in progress, adapting Socialtext::Resting. It maintains the terms, from Socialtext, of workspace and page, which are translated to recipe and tiddler.

METHODS

new

    my $Rester = TiddlyWeb::Resting->new(
        username => $opts{username},
        password => $opts{password},
        server   => $opts{server},
    );

    or

    my $Rester = TiddlyWeb::Resting->new(
        user_cookie => $opts{user_cookie},
        server      => $opts{server},
    );

Creates a TiddlyWeb::Resting object for the specified server/user/password, or server/cookie combination.

accept

    $Rester->accept($mime_type);

Sets the HTTP Accept header to ask the server for a specific representation in future requests.

Common representations:

text/plain
text/html
application/json
text/x-tiddlywiki

get_page

    $Rester->workspace('wikiname');
    $Rester->get_page('page_name');

Retrieves the content of the specified page. Note that the workspace method needs to be called first to specify which workspace to operate on.

put_page

    $Rester->workspace('wikiname');
    $Rester->put_page('page_name',$content);

Save the content as a page in the wiki. $content can either be a string, which is treated as wikitext, or a hash with the following keys:

text

A string which is the page's wiki content or a hash of content plus other stuff.

tags

A list of tags.

fields

A hash of arbitrary key value pairs.

get_pages

    $Rester->workspace('wikiname');
    $Rester->get_pages();

List all pages in the wiki.

get_revisions

    $Rester->get_revisions($page)

List all the revisions of a page.

get_workspace

    $Rester->get_workspace();

Return the metadata about a particular workspace.

get_workspaces

    $Rester->get_workspaces();

List all workspaces on the server

response

    my $resp = $Rester->response;

Return the HTTP::Response object from the last request.

AUTHORS / MAINTAINERS

Chris Dent <cdent@peermore.com>

Based on work by:

Luke Closs <luke.closs@socialtext.com>

Shawn Devlin <shawn.devlin@socialtext.com>

Jeremy Stashewsky <jeremy.stashewsky@socialtext.com>

CONTRIBUTORS

Chris Dent

Kirsten Jones

Michele Berg - get_revisions()