Dashboard > WSO2 Registry > Home > Registry Protocol
  WSO2 Registry Log in | Register   View a printable version of the current page.  
  Registry Protocol
Added by Chathura Ekanayake , last edited by Glen Daniels on Mar 19, 2008  (view change)
Labels: 
(None)

Most of the operations on the Registry can be performed by sending GET, POST, PUT and DELETE commands to URLs. Below are the list of URLs for manipulating different sections of the Registry.

URL  Resource identified by the URL
Method to add or update the resource
Method to delete the resource
/users Collection of users POST creates new user n/a
/users/[username] User resource PUT to change data DELETE
/users/[username];tags Collection of tags used by [username] POST to rename tag no
/users/[username];tags:[tag] Collection of resources tagged with [tag] by [username] n/a no
/users/[username];comments Collection of comments writing by [username] n/a no
/tags Collection of all tags used in the system n/a no
/tags/[tag] Collection of all resources tagged [tag] n/a no
/[r1] Resource [r1] POST creates new child resource (if it's a directory), PUT to change data DELETE (including children, comments, tags)
/[r1];tags Collection of tags on [r1] POST creates new tag (we can also use POST to delete tags without using
the below URL)
n/a
/[r1];tags:[tag+username] [tag] applied by [username] on /[r1]
n/a(? Exception to PUT because the tag name and value are the same thing.) DELETE
/[r1];tags:[username] Collection of tags on [r1] applied by [username] n/a no
/[r1];comments Collection of comments on [r1] POST creates new comment no
/[r1];comments:[username] Collection of comments on [r1] by [username] n/a no
/comments/[id] Comment [id] resource PUT to change content DELETE
/[r1];log Collection of log entries for [r1] n/a no
/[r1];properties Collection of metadata properties POST to add new property no
/[r1];properties:[prop] Value of [prop] property for [r1] PUT to change value DELETE
/[r1];ratings Collection of ratings of [r1] (includes average) POST to rate no
/[r1];ratings:[username] Rating of [r1] given by [username] n/a DELETE
/[r1];versions Collection of pointers to versions of [r1] n/a no
/[r1];version:[vnum] A particular version of [r1] n/a no
/[r1]/[r2] Resource [r2] See /[r1] See /[r1]
/d1/d2/[q1]?[p1=v1] Collection of results of query [q1] with parameters p1,=v1, etc. PUT to change query DELETE to remove query
/d1/d2/r1;rename no
POST will rename the resource , PUT does nothing
no
/d1/r1;[aspect]:action
(note brackets are literal!)
A custom behavior (lifecycle etc) POST invokes the action n/a

APP is used as the protocol for performing above operations. Above URLs are used to identify entries and collections to which APP requests are sent. Below are the message formats for exchanging necessary data for performing common operations on Registry.

Collection manipulation

Reading collections

Request:

GET [collection URL]

Response (option 1):

Atom feed containing atom entries for all items (resources and collections) in the collection. Atom entries returned in the feed contains all the metadata about resources except resource properties.

Response (option 2):

Atom feed containing incomplete atom entries. Child collections are represented by atom entries only containing the <link rel="edit" ...> link, which gives the URL of the feed. Child resources are represented by atom entries with <link rel="edit" ...> and <link rel="edit-media" ...> links, which gives URLs of media link entry and the media resource respectively.

Adding collections

Request:

POST [URL of the parent collection]

Content: Atom feed with the metadata of the new collection, but without any atom entries.
This should contain a suggested name (a la the "slug" header) which the user would prefer to use for the new item.

Response:

Atom feed representing the newly created collection.  This has a location header pointing to the actual URL provided by the server.

Editing collections

Only the metadata of collections can be edited. Therefore, atom entry elements in the request feed document does not affect the edit operation.

Request:

PUT [collection URL]

Content: Atom feed containing the new metadata for the collection.

Response:

Atom feed for the collection with updated metadata.

Deleting collections

Request:

DELETE [collection URL]

Response:

200 Ok

Resource manipulation

All resources are handled as media resources. Therefore, each resource contains a media link entry (atom entry) and a media resource (actual resource content).

Reading resources

Clients can GET either the media link entry or the media resource.

Request:

GET [media link entry URL]

Response:

Media link entry for the resource containing the metadata and a link <link rel="edit-media" ...> pointing to the media resource.

Request:

GET [media resource URL]

Response:

Content of the resource (e.g. text content, xml content, jpg, jar).

Adding resources

POST the resource content to the parent collection, which creates a media link entry and media resource for the new resource. Server decides the "real" URL, with help from the suggested "Slug" header.

Request:

POST [URL of the parent collection]
Slug: [suggested name]
Content: content of the new resource (e.g. text, jpg file, jar archive)

Response:

Atom entry representing the media link entry of the new resource.  Author, last-update, etc. are all filled in. The Location: header points to the actual URL of the new resource.

Deleting resources

Request:

DELETE [media link entry URL of the resource or media URL of the resource]

Response:

200 Ok

Editing resources

Request:

PUT [media URL of the resource]
<new content>

Response:

200 Ok

Commenting operations

Adding comments

Request:

POST [resource path];comments

Content: Atom entry representing the comment.

Requied elements for atom entry representing a comment:

<atom:entry>
   <author><name>[author's user name]</name></author>
   <content>[comment string]</content>
</atom:entry>

Response:

Atom entry representing the newly added comment.

Getting comments for a resource

Request:

GET [resource path];comments

Response (option 1):

Atom feed containing atom entries for comments. Atom entries in the feed contains all the details about comments including comment strings.

Response (option 2):

Atom feed containing incomplete atom entries only containing the <link rel="edit" ...> link pointing to the complete atom entry.

Rating operations

Rating resources

Request:

POST [resource path];ratings

Content: Atom entry representing the rating, or a simple form-encoded representation "rating=[rating]"

Required elements for the atom entry:

<atom:entry>
   <author><name>[author's user name]</name></author>
   <content>[rating value]</content>
</atom:entry>

Response:

Atom entry representing the newly added rating.

Getting a user's rating of a resource

Request:

GET [resource path];ratings:[user name]

Response:

Atom entry representing the user's rating.

Getting average rating of a resource

Request:

GET [resource path];rating

Response:

Atom entry representing the average rating of the resource.

Tagging operations

Applying a tag on a resource

Request:

POST [resource path];tags

Content: Atom entry representing the new tag, or a simple form-encoded tagging "tag=[tagname]"

<atom:entry>
   <author><name>[author's user name]</name></author>
   <content>[tag string]</content>
</atom:entry>

Response:

Atom entry representing the newly added tag.

Getting resources tagged with a given tag

Request:

GET tags/[tag]

Response:

Atom feed containing atom entries for the resources tagged with the given tag. Each entry contains additional extensible element containing the number of taggings.

<atom:feed>
<atom:entry>
    ... meta data ...
    <link rel="edit" href=[media link entry URL]/>
    <link rel="edit-media" href=[media resource URL]/>
    <taggings>[number of taggings]</taggings>
<atom:entry>

<atom:entry>
 ...
</atom:entry>

</atom:feed>

Getting tags applied on a resource

Request:

GET [resource path];tags

Response:

Atom feed containing atom entries to represent tags applied on the given resource. Each atom entry contains additional extensible element to store the number of tagging done using that tag.

<atom:feed>
   <atom:entry>
         <updated>[tagged time]</updated>
         <author>[user who applied the tag]</author>
         <content>[tag string]</content>
         <taggings>[number of taggings]</taggings>
   </atom:entry>

   <atom:entry>
        ...
    </atom:entry>

    ....

</atom:feed>

Query operations

Executing a query

Request:

GET [query path]?[parameter name 1 = value 1]&[...]

Response:

Atom feed containing atom entries to represent resources matched to the executed query.

Resource Rename

To rename or move a resource

Request:

POST [URL of the Resource]

Content: Content will be the suggested path of new location 

Response:

Atom feed representing the newly created resource.  This has a location header pointing to the actual URL provided by the server.

 Note : Rename only works for resource not for the collection.

Powered by a free Atlassian Confluence Open Source Project License granted to WSO2 Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators