Skip to end of banner
Go to start of banner

Standard variables

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

The standard variables are variables that you use in your scripts to work with Confluence objects.

VariableRead OnlyDescription
spaceNoRepresents space key the page belongs to (returns empty string if space is missing).
authorNoRepresents user key of the page author.
titleNoRepresents page title.
versionNoRepresents page version.
contentNoRepresents page content as a string.
attachmentsYesRepresents page attachments (file names).
createdNoRepresents page creation date.
idYesRepresents page id.
parentYesRepresents parent page id (returns -1 if parent page is missing).
updatedYesRepresents page last modification date.
watchersNoRepresents an array of users watching the page (usernames, string[]).
labelsNoRepresents an array of page labels (string[]).
tinyLinkYesRepresents a tiny url of a page (e.g. http://localhost:1990/confluence/x/AgAZ).


Example usage:

Following script takes page title, ensures that the page actually exists and returns basic currently supported standard variables.

if (size(argv) < 2) {
 return "space key and page title are not specified";
}
string spaceKey = argv[0];
string pageTitle = argv[1];
number page = getPage(spaceKey, pageTitle);
if (page < 0) {
 return "space '" + spaceKey + "' has no page '" + pageTitle + "'";
}
return
"id: " + %page%.id,
"parent: " + %page%.parent,
"title: " + %page%.title,
"space: " + %page%.space,
"author: " + %page%.author,
"version: " + %page%.version,
"content: " + %page%.content,
"attachments: " + %page%.attachments,
"created: " + %page%.created,
"updated: " + %page%.updated,
"watchers: " + %page%.watchers,
"labels: " + %page%.labels,
"tinyLink: " + %page%.tinyLink;
  • No labels