pages/{pageid}/links (GET)
Overview
Retrieve list of inbound or outbound page links
- REST Method: GET
- Method Access: public
Uri Parameters
Name | Type | Description |
pageid | string | either an integer page ID, "home", or "=" followed by a double uri-encoded page path |
Query Parameters
Name | Type | Description |
authenticate | bool? | Force authentication for request (default: false) |
redirects | int? | If zero, do not follow page redirects. |
dir | {from, to} | links pointing to a page or from a page |
Return Codes
Name | Value | Description |
OK | 200 | The request completed successfully |
Bad Request | 400 | Invalid input parameter or request body |
Forbidden | 403 | Read access to the page is required |
Not Found | 404 | Requested page could not be found |
Message Format
Output (when dir=from):
<outbound count="{int}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> ... </outbound>
Output (when dir=to):
<inbound count="{int}"> <page id="{int}" href="{uri}"> <title>{text}</title> <path>{text}</path> </page> ... </inbound>
Implementation Notes
- Links in transcluded sections are not part of this list.
C# Code Sample: Retrieve Links to a Page
The following code example retrieves all outbound internal links on the home page:
Sample Code
Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("pages", "home", "links").With("dir", "from").Get();
Sample Response from executing Code
Sample response indicating that there is one outbound link to "Page Title":
<outbound count="1"> <page id="31" href="http://deki-hayes/@api/deki/pages/31"> <title>Page Title</title> <path>Page_Title</path> </page> </outbound>
Implementation notes
Add notes about requirements or config values
Curl Code Sample: Retrieve Links to a Page
The following command retrieves a list of inbound/outbound internal links to page "foo" according to the value (to/from respectively) appended to the "dir" parameter.
Sample Code
curl -u username:password -i http://mindtouch.address/@api/deki/pages/=foo/links?dir=to (or from)
Sample Response from executing Code
A link in page "bar" points to page "hello", so there should be one outbound link for page bar:
{pageid} = bar
?dir=from
Content-Type: application/xml
<outbound count="1"> <page id="578" href="http://192.168.59.128/@api/deki/pages/578?redirects=0"> <uri.ui>http://192.168.59.128/hello</uri.ui> <title>hello</title> <path>hello</path> <namespace>main</namespace> </page> </outbound>
Naturally, page "hello" has one inbound link from page "bar":
{pageid} = hello
?dir=to
Content-Type: application/xml
<inbound count="1"> <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> </page> </inbound>
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.
Pages
- To view a list of all pages, follow the instructions here.