MindTouch Developer Center > MindTouch Deki > API Reference > GET:pages/{pageid}/export

GET:pages/{pageid}/export

Overview

public. Export a page to the specified format

Uri Parameters
NameTypeDescription
pageidstringeither an integer page ID, "home", or "=" followed by a double uri-encoded page title
Query Parameters
NameTypeDescription
format{pdf, html}?export format (pdf|html)
Return Codes
NameValueDescription
BadRequest400Invalid input parameter or request body
Forbidden403Read access to the page is required
NotFound404Requested page could not be found
Ok200The request completed successfully

Message Format

None

Implementation Notes

The Content-Disposition, Content-Length, and Content-Type headers provide information about the retrieved file.

Code Samples

The following code example exports the page called "Page_Title" to a pdf and saves it in the caller's temporary directory:

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
DreamMessage msg = p.At("pages", "=Page_Title", "export").With("format", "pdf").Get();
using (FileStream fs = System.IO.File.OpenWrite(Path.GetTempPath() + msg.ContentDisposition.FileName)) {
    byte[] fileData = msg.AsBytes();
    fs.Write(fileData, 0, fileData.Length);
}
Tag page
You must login to post a comment.
Powered by MindTouch Deki Enterprise Edition v.8.08 RC1