content.getChildrenΒΆ

This command returns children of a content.

Arguments:

key (string)
Path or id to the parent content.
start (integer)
Start index (used for paging). Default is 0.
count (integer)
Number of contents to fetch. Default is 10.
sort (string)
Sorting expression.
branch (string)
Set by portal, depending on context, to either “draft” or “master”. May be overridden, but this is not recommended. Default is the current branch set in portal.

Example:

var result = execute('content.getChildren', {
    key: '/a/b/mycontent',
    start: 5,
    count: 3,
    sort: '_modifiedTime ASC'
});

log.info('Found ' + result.total + ' number of contents');

for (var i = 0; i < result.contents.length; i++) {
    var content = result.contents[i];
    log.info('Content ' + content._name + ' loaded');
}

Result:

{
  "contents": [
    {
      "_createdTime": "1970-01-01T00:00:00Z",
      "_creator": "user:system:admin",
      "_id": "111111",
      "_modifiedTime": "1970-01-01T00:00:00Z",
      "_modifier": "user:system:admin",
      "_name": "mycontent",
      "_path": "/a/b/mycontent",
      "data": {},
      "displayName": "My Content",
      "draft": false,
      "hasChildren": false,
      "x": {},
      "page": {},
      "type": "system:unstructured"
    },
    {
      "_createdTime": "1970-01-01T00:00:00Z",
      "_creator": "user:system:admin",
      "_id": "222222",
      "_modifiedTime": "1970-01-01T00:00:00Z",
      "_modifier": "user:system:admin",
      "_name": "othercontent",
      "_path": "/a/b/othercontent",
      "data": {},
      "displayName": "Other Content",
      "draft": false,
      "hasChildren": false,
      "x": {},
      "page": {},
      "type": "system:unstructured"
    }
  ],
  "total": 2
}