site.pages()
view-source14x14.png

Purpose

Method site.pages() retrieves meta data for all pages in a site or in a site's category, like page title, parent page, when created/edited, and attached tags.

Syntax

site.pages({'site': 'site-name' <, 'category': 'category-name'> })

where “<>” denote an optional argument.

Arguments

site-name
the name of the site, whose pages to list
category-name (optional)
the name of the category, which pages to list

Returns

Page meta data for all the pages in a site or a category is returned as a list of dictionaries with the following keys.

'site'
the site's name the page is from
'category'
the page's category
'name'
the page name (without the category)
'full_name'
equal to 'name' if 'category' is _default, 'category':'name' otherwise
'title'
the page title as defined by the user
'title_shown'
the page title as displayed, including any autonumbering pattern
'title_or_unix_name'
the page title ('title') if not empty, the unix name ('name') with first letter capitalized and dashes replaced by blanks otherwise
'parent_page'
the page's parent page; None if no parent page has been set
'user_created'
the name of the user who created the page
'date_created'
date and time when the page was created; format YYYY-MM-DDThh:mm:ss+timezone1
'user_edited'
the name of the user who last edited the page; None if the page is at revision 0
'date_edited'
date and time when the page was last edited; the 'date_created' date/time if the page is at revision 0; format YYYY-MM-DDThh:mm:ss+timezone2
'tag_array'
a list of tags the page is tagged with
'tag_string'
a string of blank-separated tags the page is tagged with

Note that the returned data is the same data as returned in the 'meta' dictionary item in the list of dictionaries returned by page.get().

The pages are returned in an arbitrary order. To sort the returned list, see the Sort Returned Data snippet.

Example

The example assumes that s is a successfully authenticated ServerProxy object.

What you type … What you get …

s.site.pages({'site':'xml-api', 'category': 'doc'})

[{'category': 'doc',
  'user_edited': None,
  'tag_array': [],
  'name': 'methods',
  'title': 'Methods',
  'tag_string': '',
  'title_shown': 'Methods',
  'site': 'xml-api',
  'title_or_unix_name': 'Methods',
  'parent_page': None,
  'full_name': 'doc:methods',
  'user_created': 'ErichSteinboeck',
  'date_created': '2009-04-09T11:25:30+00:00',
  'date_edited': '2009-04-11T19:48:45+00:00'
 },
 {'category': 'doc',
  'user_edited': None,
  'tag_array': [],
  'name': 'serverproxy',
  'title': 'ServerProxy',
  'tag_string': '',
  'title_shown': 'ServerProxy',
  'site': 'xml-api',
  'title_or_unix_name': 'ServerProxy',
  'parent_page': None,
  'full_name': 'doc:serverproxy',
  'user_created': 'ErichSteinboeck',
  'date_created': '2009-04-11T19:16:22+00:00',
  'date_edited': '2009-04-11T19:47:35+00:00'
 }
]

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License