content.getΒΆ

This command fetches a content.

Arguments:

key (string)
Path or id to the content.
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.get', {
    key: '/my/content'
});

if (result) {
    log.info('Display Name = ' + result.displayName);
} else {
    log.info('Content was not found');
}

Result:

{
  "_createdTime": "1970-01-01T00:00:00Z",
  "_creator": "user:system:admin",
  "_id": "123456",
  "_modifiedTime": "1970-01-01T00:00:00Z",
  "_modifier": "user:system:admin",
  "_name": "mycontent",
  "_path": "/a/b/mycontent",
  "data": {
    "a": [1],
    "b": ["2"],
    "c": [
      {
        "d": [true]
      },
      {
        "d": [true],
        "e": [
          "3",
          "4",
          "5"
        ],
        "f": [2]
      }
    ]
  },
  "displayName": "My Content",
  "draft": false,
  "hasChildren": false,
  "x": {
    "mymodule": {
      "myschema": {
        "a": ["1"]
      }
    }
  },
  "page": {
    "config": {
      "a": ["1"]
    },
    "controller": "mymodule:mycontroller",
    "regions": [
      {
        "components": [
          {
            "config": {
              "a": ["1"]
            },
            "descriptor": "mymodule:mypart",
            "name": "mypart",
            "path": "top/0",
            "type": "part"
          },
          {
            "config": {
              "a": ["1"]
            },
            "descriptor": "mymodule:mylayout",
            "name": "mylayout",
            "path": "top/1",
            "regions": [
              {
                "components": [
                  {
                    "config": {
                      "a": ["1"]
                    },
                    "descriptor": "mymodule:mypart",
                    "name": "mypart",
                    "path": "top/1/bottom/0",
                    "type": "part"
                  }
                ],
                "name": "bottom"
              }
            ],
            "type": "layout"
          }
        ],
        "name": "top"
      }
    ]
  },
  "type": "system:unstructured"
}