Using the DTS REST API

Metadata

Action

Query

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

No

Path

/perc-metadata-services/metadata/get

Parameter

(JSON example)

{

   "criteria":[

      "type = 'page'",

      "dcterms:source like 'Test%'"

   ],

   "orderBy":"dcterms:source desc",

   "startIndex":0,

   "maxResults":2

}

Returned data

(JSON example)

[

   {

      "site":"TestSite",

      "pagepath":"/TestSiteapps/ROOT/index",

      "linktext":"Home",

      "folder":"/",

      "name":"index",

      "properties":{

         "dcterms:source":"TestSite",

         "dcterms:title":"Home",

         "dcterms:created":"2011-06-09T14:59:57"

      },

      "type":"page"

   },

   {

      "site":"TestSite",

      "pagepath":"/TestSiteapps/ROOT/copy",

      "linktext":"Home 2",

      "folder":"/",

      "name":"copy",

      "properties":{

         "dcterms:source":"TestSite 2",

         "dcterms:created":"2011-06-13T18:59:57",

         "dcterms:title":"Home"

      },

      "type":"page"

   }

]

 

Action

Tags query

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

No

Path

/perc-metadata-services/metadata/tags/get&sortTagsBy=count

Parameter

(JSON example)

For the “sortTagsBy” query param, see javadoc documentation. The JSON query criteria in the body is the same as the “Query” action.

Returned data

(JSON example)

{

   "properties":[

      {

         "tagCount":2,

         "tagName":"anothertag"

      },

      {

         "tagCount":2,

         "tagName":"bar"

      },

      {

         "tagCount":1,

         "tagName":"differenttag"

      },

      {

         "tagCount":1,

         "tagName":"foo"

      }

   ]

}

 

Action

Categories query

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

No

Path

/perc-metadata-services/metadata/categories/get

Parameter

(JSON example)

The JSON query criteria in the body is the same as the “Query” action.

Returned data

(JSON example)

[

   {

      "category":"root",

      "count":{

         "second":6,

         "first":0

      },

      "children":[

         {

            "category":"Vegetables",

            "count":{

               "second":3,

               "first":1

            },

            "children":[

               {

                  "category":"Other",

                  "count":{

                     "second":1,

                     "first":2

                  },

                  "children":[

                     {

                        "category":"Another",

                        "count":{

                           "second":0,

                           "first":1

                        },

                        "children":[

 

                        ]

                     }

                  ]

               }

            ]

         },

         {

            "category":"Fruits",

            "count":{

               "second":1,

               "first":1

            },

            "children":[

               {

                  "category":"Apples",

                  "count":{

                     "second":0,

                     "first":1

                  },

                  "children":[

 

                  ]

               }

            ]

         }

      ]

   }

]

 

Action

Save metadata entries (pages)

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

Yes (SSL and HTTP Basic Authentication)

Path

/perc-metadata-services/metadata

Parameter

(JSON example)

{

   "entries":[

      {

         "pagepath":"/site1/folder/page",

         "name":"page",

         "folder":"/folder",

         "linktext":"linktext value",

         "type":"page",

         "site":"site1",

         "properties":[

            {

               "valuetype":"STRING",

               "name":"dcterms:source",

               "stringvalue":"site1"

            },

            {

               "valuetype":"STRING",

               "name":"dcterms:title",

               "stringvalue":"page title"

            }

         ]

      },

      {

         "pagepath":"/site2/folder2/page2",

         "name":"page2",

         "folder":"/folder2",

         "linktext":"linktext value",

         "type":"page",

         "site":"site2"

      }

   ]

}

Returned data

(JSON example)

No data is returned (HTTP 204).

 

Action

Delete metadata entries (pages)

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

Yes (SSL and HTTP Basic Authentication)

Path

/perc-metadata-services/metadata/delete

Parameter

(JSON example)

[

   "/TestSiteapps/ROOT/index",

   "/site1/folder/page"

]

Returned data

(JSON example)

No data is returned (HTTP 204).

 

Action

Clean folder indexes

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

Yes (SSL and HTTP Basic Authentication)

Path

/perc-metadata-services/metadata/clean

Parameter

(JSON example)

/TestSiteapps/ROOT

Returned data

(JSON example)

No data is returned (HTTP 204).

 

Action

Get all indexed directories

Description, parameters, return value, error conditions and other information

 

Verb

GET

Is secured?

No

Path

/perc-metadata-services/metadata/indexedDirectories

Parameter

(JSON example)

 

Returned data

(JSON example)

[

   "/TestSiteapps/ROOT/rx_resources",

   "/site2/folder2"

]

 

Forms

Action

Add a form

Description, parameters, return value, error conditions and other information

Saves a new form. It consumes data from a submitted HTML form:

“application/x-www-form-urlencoded”

Verb

POST

Is secured?

No

Path

/perc-form-processor/form/

Returned data

This method always returns an HTTP 200 as after submitting the form, it redirects to the success page. If there was an error, it redirects to the error page. For instance, after a succesful submission, this is the redirect URL for the default success page:

http://generic:9980/perc-form-processor/success.html

Method in REST Service

create

 

Action

Delete form

Verb

DELETE

Is secured?

Yes

Path

/perc-form-processor/form/{formName}

Parameter

(URL example)

http://localhost:9980/perc-form-processor/form/FormTest

Returned data

(description)

HTTP 204 (No content)

Method in REST Service

delete

 

Action

Get forms

Verb

GET

Is secured?

Yes

Path

/perc-form-processor/form/

Returned data

(JSON example)

{"formsInfo": [

       {"totalForms":1,"exportedForms":0,"name":"FormRedirect"},

       {"totalForms":2,"exportedForms":0,"name":"FormTest"}

                  ]

}

Method in REST Service

get

 

Action

Get form by name

Verb

GET

Is secured?

Yes

Path

/perc-form-processor/form/{formName}

Returned data

(JSON example)

{"formsInfo": [

       {"totalForms":2,"exportedForms":0,"name":"FormTest"}

                 ]

}

Method in REST Service

get

 

Action

Export form to CSV file

Verb

GET

Description, parameters, return value, error conditions and other information

* See javadoc for more information of parameters supported

Is secured?

Yes

Path

/perc-form-processor/form/{formName}/{csvFile}

Returned data

(CSV example)

Form name,Create date,Entry-field-label,Select-your-level

FormTest,2011-08-15 15:36:31.65,Default text can be added to any text box.,Medium

FormTest,2011-08-15 15:36:35.056,Default text can be added to any text box.,Low

 

Method in REST Service

export

 

Comments

Action

Query

Description, parameters, return value, error conditions and other information

 

Verb

POST

Is secured?

No

Path

/perc-comments-services/comment

Parameter

(JSON example)

{

   "pagepath" : "/site/page/path",

   "username" : "milton",

   "tag" : "foo",

   "sort" : {

       "sortby" : "USERNAME",

       "ascending" : true

   },

   "state" : "APPROVED",

   "site" : "SiteName",

   "moderated" : false,

   "viewed" : true,

   "maxResults" : 5,

   "startIndex" : 2,

   "lastCommentId" : 23

}

Returned data

(JSON example)

{

  "comments":[

     {

        "username":"miltondp2",

        "url":"http://percussion.com",

        "tags":[

 

        ],

        "site":"TestSite",

        "pagePath":"/Comments",

        "approvalState":"APPROVED",

        "viewed":false,

        "moderated":false,

        "email":"mpividori@pecussion.com",

        "createdDate":"2011-06-09T15:51:31-0430",

        "parent":0,

        "id":2,

        "title":"Title of comment 2",

        "text":"Second one"

     },

     {

        "username":"miltondp",

        "url":"http://percussion.com",

        "tags":[

 

        ],

        "site":"TestSite",

        "pagePath":"/Comments",

        "approvalState":"APPROVED",

        "viewed":false,

        "moderated":false,

        "email":"mpividori@pecussion.com",

        "createdDate":"2011-06-09T15:51:14-0430",

        "parent":0,

        "id":1,

        "title":"Title of comment 1",

        "text":"This is my first comment."

     }

  ]

}

 

Action

Query as moderator

 

 

Verb

POST

Is secured?

No

Path

/perc-comments-services/comment/asmoderator

Parameter

(JSON example)

See “Query” action

Returned data

(JSON example)

See “Query” action

Method in REST Service

getCommentsAsModerator

 

Action

Query (JSONP)

Verb

GET

Is secured?

No

Path

/perc-comments-services/comment/jsonp

Parameter

(URL example)

/perc-comments-services/comment/jsonp?pagepath=/site/path/page&site=site&callback=myfunc

 

* see javadoc for more information of parameters supported

Returned data

(description)

The returned value wraps the list of comments in a function specified by “callback”.

Method in REST Service

getCommentsP

 

Action

Get pages with comments

Verb

GET

Is secured?

No

Path

/perc-comments-services/comment/pageswithcomments/{site}

Parameter

(JSON example)

 

Returned data

(JSON example)

{

  "summaries":[

     {

        "pagePath":"/Comments",

        "commentCount":2,

        "approvedCount":2,

        "newCommentCount":2

     }

  ]

}

Method in REST Service

getPagesWithComments

 

Action

Add comment

Verb

POST

Is secured?

No

Path

/perc-comments-services/comment

Parameter

(JSON example)

* see javadoc for more information of parameters supported

Returned data

(description)

This method always returns an HTTP 303 (See other) status code. The redirected URL lool like this:

 

http://host:9980/Comments?lastCommentId=3

 “lastCommentId” contains the id of the recently added comment.

Method in REST Service

addComment

 

 

Action

Delete comment

Verb

PUT

Is secured?

Yes

Path

/perc-comments-services/comment/moderation/delete

Parameter

(JSON example)

{

   "comments" : [

       12,

       34,

       7

   ]

}

Returned data

(description)

HTTP 204 (No content)

Method in REST Service

delete

 

Action

Approve comment

Verb

PUT

Is secured?

Yes

Path

/perc-comments-services/comment/moderation/approve

Parameter

(JSON example)

{

   "comments" : [

       12,

       34,

       7

   ]

}

Returned data

(JSON example)

HTTP 204 (No content)

Method in REST Service

approve

 

Action

Reject comment

Verb

PUT

Is secured?

Yes

Path

/perc-comments-services/comment/moderation/reject

Parameter

(JSON example)

{

   "comments" : [

       12,

       34,

       7

   ]

}

Returned data

(JSON example)

HTTP 204 (No content)

Method in REST Service

reject

 

Action

Set default moderation state

Verb

PUT

Is secured?

Yes

Path

/perc-comments-services/comment/moderation/defaultModerationState

Parameter

(JSON example)

{

  "defaultModerationState":{

     "site":"TestSite",

     "state":"APPROVED"

  }

}

Returned data

(JSON example)

HTTP 204 (No content)

Method in REST Service

setDefaultModerationState

 

Action

Get default moderation state

Verb

GET

Is secured?

No

Path

/perc-comments-services/comment/defaultModerationState/{site}

Parameter

(JSON example)

 

Returned data

(JSON example)

 

Method in REST Service

getDefaultModerationState

 

Leave a comment

*
*