NAME

Socialtext::Resting - module for accessing Socialtext REST APIs

SYNOPSIS

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

DESCRIPTION

Socialtext::Resting is a module designed to allow remote access to the Socialtext REST APIs for use in perl programs.

METHODS

new

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

Creates a Socialtext::Resting object for the specified server/user/password combination.

accept

$Rester->accept($mime_type);

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

Standard representations: http://www.socialtext.net/st-rest-docs/index.cgi?standard_representations

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.

get_attachment

$Rester->workspace('wikiname');
$Rester->get_attachment('attachment_id');

Retrieves the specified attachment from the workspace. Note that the workspace method needs to be called first to specify which workspace to operate on.

put_workspacetag

$Rester->workspace('wikiname');
$Rester->put_workspacetag('tag');

Add the specified tag to the workspace.

put_pagetag

$Rester->workspace('wikiname');
$Rester->put_pagetag('page_name', 'tag');

Add the specified tag to the page.

delete_workspacetag

$Rester->workspace('wikiname');
$Rester->delete_workspacetag('tag');

Delete the specified tag from the workspace.

delete_pagetag

$Rester->workspace('wikiname');
$Rester->delete_pagetag('page_name', 'tag');

Delete the specified tag from the page.

post_attachment

$Rester->workspace('wikiname');
$Rester->post_attachment('page_name',$id,$content,$mime_type);

Attach the file to the specified page

post_comment

$Rester->workspace('wikiname');
$Rester->post_comment( 'page_name', "me too" );

Add a comment to a page.

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:

content

A string which is the page's wiki content.

date

RFC 2616 HTTP Date format string of the time the page was last edited

from

A username of the last editor of the page. If the the user does not exist it will be created, but will not be added to the workspace.

name_to_id

my $id = $Rester->name_to_id($name);
my $id = Socialtext::Resting::name_to_id($name);

Convert a page name into a page ID. Can be called as a method or as a function.

get_pages

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

List all pages in the wiki.

get_workspace_tags

$Rester->workspace('foo');
$Rester->get_workspace_tags()

List all the tags in workspace foo.

get_homepage

Return the page name of the homepage of the current workspace.

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

List all backlinks to the specified page

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

List all 'frontlinks' on the specified page

get_pagetags

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

List all pagetags on the specified page

get_taggedpages

$Rester->worksapce('wikiname');
$Rester->get_taggedpages('tag');

List all the pages that are tagged with 'tag'.

get_tag

$Rester->workspace('wikiname');
$Rester->get_tag('tag');

Retrieves the specified tag from the workspace. Note that the workspace method needs to be called first to specify which workspace to operate on.

get_breadcrumbs

$Rester->get_breadcrumbs('workspace')

Get breadcrumbs for current user in this 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, <chris.dent@socialtext.com> Kirsten Jones <kirsten.jones@socialtext.com> Luke Closs <luke.closs@socialtext.com> Shawn Devlin <shawn.devlin@socialtext.com>