Restful API

Last modified by Vincent Massol on 2024/11/19 16:12

 XWiki
 Implementation
 Completed
 

Description

Introduction

The goal of the project is to expose the XWiki API as a RESTful Web service, in order to increase the XWiki data portability. For that we used a lightweight and flexible REST framework: Restlet (http://www.restlet.org/). Data is retrieved in the XML format, a  simple browser gives you access to all the data retrieved by the GET calls.

In order to provide an effective RESTful service and to leverage REST principles, some guidelines should be followed. I think that this blog post by Stefan Tilkov about RESTful APIs proposes a good checklist. Roy Fielding's post is also enlightening and criticizes a so-called "REST API" as being an RPC mock. Another interesting article is the one by Steve Vinoski about RESTful Web Services Development Checklist 

Tilkov's checklist is the following:

  • Do the URIs actually identify resources, or do they encode operations?
  • Are the HTTP verbs - GET, PUT, POST, DELETE - used according to their defined meaning? Or is e.g. a GET used for operations that have side effects a client would not want when following a link?
  • Is hypermedia used, i.e. are there links in the representations that a client can follow?
  • Are MIME types used to differentiate data types (in Accept and Content-type) headers?
  • Are caching and conditional GET supported, i.e. are there appropriate cache control headers and ETags?

Interesting article by Subbu-Allamaraju about RESTful APIs.

Dataset

A brief and high-level description of the XWiki data set that should serve as a basis for identifying resources and their associated operations.

XWiki has pages organized in spaces. Each page is available in multiple versions (its history) and translations. Translated pages have their own versions and history which are independent. Each page might have attachments. Each attachment has its own history. Attachments are shared among all the different translations of a page (i.e., the same set of attachment is the same regardless of the page language). Pages can have one or more objects. Objects are instances of a class that contains a set of properties. Some object might be directly exposed as first class entities, such as comments and tags. Objects, as attachments, are shared among all page translations.

The HATEOAS graph

This PDF shows all the resources and the links among them with the associated relations. The graph should be read in the following way:

  • Each node represents a resource. The node is labeled using its URI template and the supported HTTP methods
  • Each edge represent a link that is present in the standard representation of the resource. If there is an edge between two nodes, then it is possible to navigate from a resource to another following the corresponding link. Each edge is labeled with the RELation associated to the link.

The "entry point" of the API is on the top-right corner 

Resources

Given the previous data set here it is a list of resources that need to be addressed through the REST api. This list is a refinement with respect to the one provided in the current implementation (see next section) and it takes into account some aspects that weren't present in it.

Restlet provides out of the box support for WADL description. The way it does it is by sending a WADL representation when a resource is requested through the OPTIONS method. So basically every resource can be queries using an OPTION request in order to be described using WADL. If the toplevel resource / is sent an OPTIONS request, the whole application (i.e., all the available resources) will be described through WADL. This feature has been temporarily removed because the Restlet JAX-RS extension doesn't support yet WADL generation. Since we switched to JAX-RS we will re-introduce this feature as soon as Restlet will make it available.

Striked out items have already been implemented in the current Trunk (1.8)

Root

  • / A service document that contains the links to all the toplevel exposed resources (e.g., spaces, tags, etc.)

Wikis

  • /wikis A list of the available (virtual) wikis
  • */wikis/{wikiName}/search?q={keywords}[[&scope={name,content,title,objects}...]&number=n] (The list of pages and objects that contain the keywords in their scope. Multiple scopes can be specified)

Spaces

  • /wikis/{wikiName}/spaces[?start=offset&number=n] (The list of available spaces)
  • */wikis/{wikiName}/spaces/{spaceName}/search?q={keywords}[[&scope={name,content,title,objects}...]&number=n] (The list of pages and objects in the space that contain the keywords in their scope. Multiple scopes can be specified)

Pages

  • /wikis/{wikiName}/spaces/{spaceId}/pages[?start=offset&number=n] (The list of available pages in the space {spaceId}.)
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId} (The page {spaceId}.{pageId}.)
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history[?start=offset&number=n] (The list of all the available revision of the page {space}.{page})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version} (The page {spaceId}.{pageId}. at version {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/translations[?start=offset&number=n] (The list of all available translations of the page {spaceId}.{pageId})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/translations/{lang} (The page {spaceId}.{pageId} in its {lang} translation)
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/translations/{lang}/history (The list of all the available revision of the page {spaceId}.{pageId} in it {lang} translation.)
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/translations/{lang}/history/{version} (The page {spaceId}.{pageId} in its {lang} translation at version {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/children (The list of all children of page {spaceId}.{pageId})

Tags

  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/tags (The list of tags for a given page)
  • /wikis/{wikiName}/tags (The list of all available tags)
  • /wikis/{wikiName}/tags/{tag1}[;{tag2};{tag3}...][?start=offset&number=n] (The list of pages tagged with tags {tag1}, {tag2}, {tag3}, ...)

Comments

  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/comments[?start=offset&number=n] (The list of comments associated to the page {spaceId}.{pageId}.)
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/comments/{commentId} (A specific {commentId})
  • /wikis/{wikiName}/wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{versionId}/comments[?start=offset&number=n] (The list of comments associated to the page {spaceId}.{pageId} at version {version}.)
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/comments/{commentId} (A specific {commentId} at a given page {version})

Attachments

  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/attachments[?start=offset&number=n] (The list of attachments associated to the page {spaceId}.{pageId})
  • /wikis/{wikiName}/wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/attachments/{attachmentName} (The list of attachments associated to the page {spaceId}.{pageId})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/attachments[?start=offset&number=n] (The attachment {attachmentName} associated to the page {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/attachments/{attachmentName} (The attachment {attachmentName} associated to the page {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/attachments/{attachmentName}/history
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/attachments/{attachmentName}/history/{version}

Objects

  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects[?start=offset&number=n] (The list of objects associated to a {page})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/{className}[?start=offset&number=n] (The list of objects instance of {className})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/{className}/{objectNumber} (The object identified by {className}[{objectNumber}])
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/{className}/{objectNumber}/properties (The property list for the object identified by {className}[{objectNumber}])
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/{className}/{objectNumber}/properties/{property} (The {property} the object identified by {className}[{objectNumber}])
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/guid/{guid} (The object identified by its {guid})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/guid/{guid}/properties (The property list for the object identified by its {guid})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/objects/guid/{guid}/properties/{property} (The {property} for the object identified by its {guid})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/objects[?start=offset&number=n] (The list of objects associated to a page at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/objects/{className} (The list of objects instances of {className}[{objectNumber}] associated to a {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/objects/{className}/{objectNumber} (The object identified by {className}[{objectNumber}] associated to a {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/objects/guid/{guid} (The object identified by its {guid} associated to a {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/objects/guid/{guid}/properties (The list of properties of the object identified by its {guid} associated to a {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/history/{version}/objects/guid/{guid}/properties/{property} (The {property} of the object identified by its {guid} associated to a {spaceId}.{pageId} at a specific {version})
  • /wikis/{wikiName}/class/{className}/objects (The list of objects instances of {className})

Classes

  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/class (The class associated to the page {spaceId}.{pageId})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/class/properties (The property list of the class associated to the page {spaceId}.{pageId})
  • /wikis/{wikiName}/spaces/{spaceId}/pages/{pageId}/class/properties/{property} (The property of the class associated to the page {spaceId}.{pageId})
  • /wikis/{wikiName}/classes[?start=offset&number=n] (All the classes defined in the wiki)
  • /wikis/{wikiName}/classes/{class} (The class {class})
  • /wikis/{wikiName}/classes/{class}/properties (The propety list of the {class})
  • /wikis/{wikiName}/classes/{class}/properties/{propertyName} (The propety of the {class})

Other

  • /wikis/{wikiName}/modifications[?start=offset&number=n&timestamp=t] (The list of pages that have been modified since the timestamp t)
  • /wikis/{wikiName}/watchlist[?start=offset&number=n] (The list of pages that are currently watched)

Suggested by Luis Arias in the mailing list. Could be interesting to expose these resources properly mapped on the XWiki's model:

  • /wikis/{wikiName}/users/{userId}/spaces/{spaceId}/recent Recent activity of a user on a shared space.
  • /wikis/{wikiName}/groups/{groupId}
  • /wikis/{wikiName}/users/{userId}/friends

Many resources that represent lists can be constrained using the [?start=offset&number=n] query parameters. This can be useful to limit the number of structures that will be transfered.

Resources (second proposal) - Not accepted

This second proposal makes use of query parameters instead of encoding resource variants (i.e., page language and version) as a part of the URI. It leads to a more compact set of resources. 

Being all parameters optional, whenever a parameter is missing a default value is assumed. These defaults are: start = 0, number = all the dataset, lang = default language, version = latest version.

  • /spaces[?start=s&number=n]
  • /spaces/{spaceId}/pages[?start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}[?lang=l&version=v]
  • /spaces/{spaceId}/pages/{pageId}/history[?lang=l&start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}/translations[?start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}/attachments[?version=v&start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}/attachments/{attachment}[?version=v]
  • /spaces/{spaceId}/pages/{pageId}/attachments/{attachment}/history[?start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}/objects[?version=v&start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}/objects/{guid}[?version=v]
  • /spaces/{spaceId}/pages/{pageId}/objects/{guid}properties[?version=v]
  • /spaces/{spaceId}/pages/{pageId}/objects/{guid}properties{propertyName}[?version=v]
  • /spaces/{spaceId}/pages/{pageId}/comments[?version=v&start=s&number=n]
  • /spaces/{spaceId}/pages/{pageId}/comments/{comment}[?version=v]
  • /spaces/{spaceId}/pages/{pageId}/tags[?version=v&start=s&number=n]
  • /classes[?start=offset&number=n] 
  • /classes/{class} 
  • /objects/{class}[?start=s&number=n]
  • /tags[?start=offset&number=n]
  • /tags/{tag1}[;{tag2};{tag3}...][?start=offset&number=n] 
  • /modifications[?start=offset&number=n&timestamp=t]
  • /watchlist[?start=offset&number=n]

This second proposal should not have any drawback, except for some kind of semantic ambiguity on some URIs, but may have repercussion on the representation returned. A thing to be checked is what is the semantics of query parameters in case of PUT, POST and DELETE operations. But I think that they are taken into account because they are part of the URI.

Media types

Media types are specified by using an XML Schema Definition file. In order to have a better visualization you can import it in Eclipse and open it with the XSD editor.

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.xwiki.org" xmlns:xwiki="http://www.xwiki.org"
  elementFormDefault="qualified">

  <complexType name="Link">
    <attribute name="href" type="string"></attribute>
    <attribute name="rel" type="string"></attribute>
    <attribute name="type" type="string"></attribute>
    <attribute name="hrefLang" type="string"></attribute>
  </complexType>

  <complexType name="LinkCollection">
    <sequence>
      <element name="link" type="xwiki:Link" minOccurs="0" maxOccurs="unbounded"></element>
    </sequence>
  </complexType>

  <complexType name="Translations">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="translation" type="xwiki:Translation" minOccurs="0" maxOccurs="unbounded"></element>
        </sequence>
        <attribute name="default" type="string"></attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Translation">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <attribute name="language" type="string"></attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="XWiki">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="version" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Wiki">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="string"></element>
          <element name="name" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Space">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="string"></element>
          <element name="wiki" type="string"></element>
          <element name="name" type="string"></element>
          <element name="home" type="string"></element>
          <element name="xwikiUrl" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="PageSummary">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="string"></element>
          <element name="fullName" type="string"></element>
          <element name="wiki" type="string"></element>
          <element name="space" type="string"></element>
          <element name="name" type="string"></element>
          <element name="title" type="string"></element>
          <element name="parent" type="string"></element>
          <element name="xwikiUrl" type="string"></element>
          <element name="translations" type="xwiki:Translations"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Page">
    <complexContent>
      <extension base="xwiki:PageSummary">
        <sequence>
          <element name="language" type="string"></element>
          <element name="version" type="string"></element>
          <element name="majorVersion" type="int"></element>
          <element name="minorVersion" type="int"></element>
          <element name="created" type="dateTime"></element>
          <element name="creator" type="string"></element>
          <element name="modified" type="dateTime"></element>
          <element name="modifier" type="string"></element>
          <element name="content" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="HistorySummary">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="pageId" type="string"></element>
          <element name="wiki" type="string"></element>
          <element name="space" type="string"></element>
          <element name="name" type="string"></element>
          <element name="version" type="string"></element>
          <element name="majorVersion" type="int"></element>
          <element name="minorVersion" type="int"></element>
          <element name="modified" type="dateTime"></element>
          <element name="modifier" type="string"></element>
          <element name="language" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Attachment">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="string"></element>
          <element name="name" type="string"></element>
          <element name="size" type="int"></element>
          <element name="version" type="string"></element>
          <element name="pageId" type="string"></element>
          <element name="pageVersion" type="string"></element>
          <element name="mimeType" type="string"></element>
          <element name="author" type="string"></element>
          <element name="date" type="dateTime"></element>
          <element name="xwikiUrl" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Comment">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="int"></element>
          <element name="pageId" type="string"></element>
          <element name="author" type="string"></element>
          <element name="date" type="dateTime"></element>
          <element name="highlight" type="string"></element>
          <element name="text" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="ObjectSummary">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="string"></element>
          <element name="guid" type="string"></element>
          <element name="pageId" type="string"></element>
          <element name="wiki" type="string"></element>
          <element name="space" type="string"></element>
          <element name="pageName" type="string"></element>
          <element name="className" type="string"></element>
          <element name="number" type="int"></element>
          <element name="headline" type="string"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Object">
    <complexContent>
      <extension base="xwiki:ObjectSummary">
        <sequence>
          <element name="property" type="xwiki:Property" minOccurs="0" maxOccurs="unbounded">
          </element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Property">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="attribute" type="xwiki:Attribute" maxOccurs="unbounded" minOccurs="0"></element>
          <element name="value" type="string"></element>
        </sequence>

        <attribute name="name" type="string" use="required"></attribute>

        <attribute name="type" type="string" use="optional"></attribute>

      </extension>
    </complexContent>
  </complexType>

  <complexType name="Attribute">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <attribute name="name" type="string" use="required"></attribute>

        <attribute name="value" type="string"></attribute>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="Class">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="id" type="string"></element>
          <element name="name" type="string"></element>
          <element name="property" type="xwiki:Property" minOccurs="0" maxOccurs="unbounded"></element>
        </sequence>

      </extension>
    </complexContent>
  </complexType>


  <!--
  * ELEMENTS
  *
  *  
 -->

  <element name="xwiki" type="xwiki:XWiki"></element>

  <element name="wikis">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="wiki" type="xwiki:Wiki" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>

        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="spaces">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="space" type="xwiki:Space" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>

        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="pages">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="pageSummary" type="xwiki:PageSummary" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="wiki" type="xwiki:Wiki"></element>

  <element name="space" type="xwiki:Space"></element>

  <element name="page" type="xwiki:Page"></element>

  <element name="history">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="historySummary" type="xwiki:HistorySummary" minOccurs="0" maxOccurs="unbounded">
            </element>
          </sequence>

        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="attachments">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="attachment" type="xwiki:Attachment" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="comments">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="comment" type="xwiki:Comment" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="comment" type="xwiki:Comment"></element>

  <element name="attachment" type="xwiki:Attachment"></element>

  <element name="property" type="xwiki:Property"></element>

  <element name="class" type="xwiki:Class"></element>

  <element name="classes">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="class" type="xwiki:Class" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>

        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="objects">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="objectSummary" type="xwiki:ObjectSummary" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="object" type="xwiki:Object"></element>

  <element name="translations" type="xwiki:Translations"></element>

  <element name="properties">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="property" type="xwiki:Property" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>

        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="objectSummary" type="xwiki:ObjectSummary"></element>

  <complexType name="Tag">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <attribute name="name" type="string"></attribute>
      </extension>
    </complexContent>
  </complexType>

  <element name="tag" type="xwiki:Tag"></element>

  <element name="tags">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="tag" type="xwiki:Tag" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <complexType name="SearchResult">
    <complexContent>
      <extension base="xwiki:LinkCollection">
        <sequence>
          <element name="type" type="string"></element>
          <element name="id" type="string"></element>
          <element name="pageFullName" type="string"></element>
          <element name="wiki" type="string"></element>
          <element name="space" type="string"></element>
          <element name="pageName" type="string"></element>
          <element name="className" type="string" minOccurs="0"></element>
          <element name="objectNumber" type="int" minOccurs="0"></element>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="searchResult" type="xwiki:SearchResult"></element>

  <element name="searchResults">
    <complexType>
      <complexContent>
        <extension base="xwiki:LinkCollection">
          <sequence>
            <element name="searchResult" type="xwiki:SearchResult" minOccurs="0" maxOccurs="unbounded"></element>
          </sequence>
          <attribute name="template" type="string"></attribute>
        </extension>
      </complexContent>
    </complexType>
  </element>
</schema>

Current implementation

This section refers to the work done by Alexandru Cismaru during the last GSoc. 

URL Patterns

These URLs patterns are used by the Rest Applicaion to determine which resource needs to receive the call. When defining URLs we use {} to have parts of the URL that will be converted as parameters.\

 .../spaces

  • GET: retrieves the list of spaces from a wiki;

.../spaces/{spaceName}

  • GET: retrieves a space (specified by the spaceName parameter);
  • POST: creates a space;
  • DELETE: removes a space;

.../spaces/{spaceName}/pages

  • GET: retrieves the pages from the specified space;

.../spaces/{spaceName}/pages/{pageName}

  • GET: retrieves the specified page (pageName) from the specified space (spaceName);
  • POST: creates a page with the name: "pageName" in the specified space, it accepts query parameters: title, content and parent;
  • DELETE: removes the page with the pageName from the specified space;

.../spaces/{spaceName}/pages/{pageName}/history\

  • GET: retrieves the list of page versions;

.../spaces/{spaceName}/pages/{pageName}/history/{version}\

  • GET: retrieves a specific version of the page;
  • DELETE: removes the specified version;

.../spaces/{spaceName}/pages/{pageName}/comments

  • GET: retrieves the list of comments from the specified page;
  • POST: creates a comment, it accepts query parameters: author and content;

.../spaces/{spaceName}/pages/{pageName}/comments/{commentNumber} \

  • GET: retrieves a comment from the page;
  • DELETE: removes a comment from the page;

.../spaces/{spaceName}/pages/{pageName}/attachments\

  • GET: retrieves the list of attachments from the page;

.../spaces/{spaceName}/pages/{pageName}/attachments/{attachmentName}\

  • GET: retrieves information about an attachment;
  • DELETE: removes the specified attachment;

.../spaces/{spaceName}/pages/{pageName}/class\

  • GET: retrieves the class of the specified page;

.../spaces/{spaceName}/pages/{pageName}/class/properties\

  • GET: retrieves the list of class properties;

.../spaces/{spaceName}/pages/{pageName}/class/properties/{propertyName}\

  • GET: retrieves a class property;

.../spaces/{spaceName}/pages/{pageName}/objects\

  • GET: retrieves the list of objects in a page;

.../spaces/{spaceName}/pages/{pageName}/objects/{className}\

  • GET: retrieves the list of objects in a page, from a give class;

.../spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber}\

  • GET: retrieves an object in a page, from a given class;
  • DELETE: removes the specified object;

.../spaces/{spaceName}/pages/{pageName}/objects/{className}/{objectNumber}/{propertyName}\

  • GET: retrieves a property.

{style:type=span|font-size=18px}Methods:{style}

  • GET: retrieves XML content, returns 200 if the request was succesful, and 404 if the resource was not found.
  • POST: creates/updates  content, returns  201 (Created) in case of success and 200 if the resource is not created.
  • DELETE: removes content, returns 204 (No Content) in case of success and 400 (Bad Request) in case of failure.

 

Get Connected