Wiki
Clone wikitree-view / Tree View REST interface
Tree View REST interface
Table of contents
Availability
Version 1.0 of the REST interface is available since Tree View version 1.2.0.
General
Return formats
The interface supports XML and JSON as return formats. Per default all functions return XML. In case you need JSON you may have to set the return format in your call.
Status codes
The following status codes can be returned by the REST interface:
- 200: success (XML or JSON data will be returned)
- 403: forbidden; forbidden is returned when a non admin tries to perform actions where admin rights are necessary or due to a missing view permissions on a page where you want to set a view
- 404: not found; not found is returned in case the page or user was not found
Functions for all users
Is a page covered by any tree watch?
Call:
/rest/treeviewrest/1.0/{id}/isCovered
Sample:
/rest/treeviewrest/1.0/7995468/isCovered
Response when the page is not covered:
{ "result": "false" }
Response when a page is covered (true followed by the page ID of the first tree watch covering the page):
{ "result": "true;7995470" }
Watch a tree of pages
Call:
/rest/treeviewrest/1.0/{id}/watchTree
Sample:
/rest/treeviewrest/1.0/7995468/watchTree
{ "result": "success" }
Un-watch a tree of pages
Call:
/rest/treeviewrest/1.0/{id}/unwatchTree
Sample:
/rest/treeviewrest/1.0/7995468/unwatchTree
Response in case of success:
{ "result": "success" }
Get all of my tree watches
Call / sample:
/rest/treeviewrest/1.0/getMyTreeWatches
Response in case of success:
{ "treeWatch": [ { "id": 7995442, "username": "muller-ja" }, { "id": 7995452, "username": "muller-ja" } ] }
Functions for admins
Is a page covered by any tree watch of a specified user?
Call:
/rest/treeviewrest/1.0/{id}/isCovered?username=xyz
Sample:
/rest/treeviewrest/1.0/7995468/isCovered?username=smith-to
Response when the page is not covered:
{ "result": "false" }
Response when a page is covered (true followed by the page ID of the first tree watch covering the page):
{ "result": "true;7995470" }
Let an user watch a tree of pages
Call:
/rest/treeviewrest/1.0/{id}/watchTree?username=xyz
Sample:
/rest/treeviewrest/1.0/7995468/watchTree?username=smith-to
Response in case of success:
{ "result": "success" }
Remove the tree watch of an user
Unintended remove of page watches: as the Tree View plugin basically sets the watch flag on all pages when applying a watch tree command and the user is allowed to change the watch flag on each page subsequently you never know whether removing all the flags is intentional or not!
Call:
/rest/treeviewrest/1.0/{id}/unwatchTree?username=xyz
{id} is the ID of the page from where on you want to remove all watches/tree watches; in most cases it should be the ID of a page where an active tree watch sits; xyz is the name of the Confluene user you want to add the tree watch for
Sample:
/rest/treeviewrest/1.0/7995468/unwatchTree?username=smith-to
Response in case of success:
{ "result": "success" }
Get all tree watches
Call / sample:
/rest/treeviewrest/1.0/getTreeWatches
Response in case of success:
{ "treeWatch": [ { "id": 5832732, "username": "smith-to" }, { "id": 7995442, "username": "muller-ja" }, { "id": 7995452, "username": "muller-ja" } ] }
Get all tree watches of a certain page
Call:
/rest/treeviewrest/1.0/{id}/getTreeWatches
{id} is the ID of the page from which you want to get the tree watches.
Sample:
/rest/treeviewrest/1.0/7995468/getTreeWatches
Response in case of success:
{ "treeWatch": [ { "id": 7995468, "username": "smith-to" }, { "id": 7995468, "username": "muller-ja" } ] }
Get all tree watches of a specified user
Call:
/rest/treeviewrest/1.0/getTreeWatches?username=xyz
Sample:
/rest/treeviewrest/1.0/getTreeWatches?username=muller-ja
Response in case of success:
{ "treeWatch": [ { "id": 7995442, "username": "muller-ja" }, { "id": 7995452, "username": "muller-ja" } ] }
Updated