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 8 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