pages/popular (GET)
Overview
Retrieves a list of popular pages.
- REST Method: GET
- Method Access: public
Query Parameters
Name | Type | Description |
offset | int? | Number of items to skip. Must be a positive number or 0 to not skip any. (default: 0) |
limit | string? | Maximum number of items to retrieve. Must be a positive number or 'all' to retrieve all items. (default: 50) |
authenticate | bool? | Force authentication for request (default: false) |
Return Codes
Name | Value | Description |
OK | 200 | The request completed successfully |
Message Format
Output:
<pages.popular count="{int}" href="{uri}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> <metrics> <metric.views>{int}</metric.views> </metrics> </page> ... </pages.popular>
Implementation Notes
Redirect and archived pages are not included in the output.
"Metric views" in the output means page views.
C# Code Sample: Retrieve Popular Pages
The following code example retrieves the popular pages:
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("pages", "popular").Get();
Sample Response from executing Code
Sample response indicating that there are two popular pages:
<pages.popular count="2" href="http://deki-hayes/@api/deki/pages/popular"> <page id="29" href="http://deki-hayes/@api/deki/pages/29"> <title>DekiWiki (Hayes)</title> <path /> <metrics> <metric.views>23</metric.views> </metrics> </page> <page id="31" href="http://deki-hayes/@api/deki/pages/31"> <title>Page Title</title> <path>Page_Title</path> <metrics> <metric.views>5</metric.views> </metrics> </page> </pages.popular>
Curl Code Sample: Retrieve Popular Pages
The following command retrieves a list of the most popular pages on the site:
Sample Code
curl -u username:password -i http://mindtouch.address/@api/deki/pages/popular
Sample Response from executing Code
Sample response of the top 3 most popular pages on a site. Append "?limit=3" to end of command:
Content-Type: application/xml
<pages.popular count="3" href="http://192.168.59.128/@api/deki/pages/popular"> <page id="21" href="http://192.168.59.128/@api/deki/pages/21?redirects=0"> <uri.ui>http://192.168.59.128/</uri.ui> <title>Best Wiki Ever</title> <path/> <namespace>main</namespace> <metrics> <metric.views>380</metric.views> </metrics> </page> <page id="567" href="http://192.168.59.128/@api/deki/pages/567?redirects=0"> <uri.ui>http://192.168.59.128/FUBAR</uri.ui> <title>FUBAR</title> <path>FUBAR</path> <namespace>main</namespace> <metrics> <metric.views>83</metric.views> </metrics> </page> <page id="565" href="http://192.168.59.128/@api/deki/pages/565?redirects=0"> <uri.ui>http://192.168.59.128/Bar</uri.ui> <title>Bar</title> <path>Bar</path> <namespace>main</namespace> <metrics> <metric.views>76</metric.views> </metrics> </page> </pages.popular>
Implementation notes
curl flags
- -u
- Provides external user authentication. Note that if anonymous access is available and authentication is not forced, this flag may be omitted.
- -i
- Outputs the HTTP response headers. Useful for debugging.