public. Export a page to the specified format
| Name | Type | Description |
| pageid | string | either an integer page ID, "home", or "=" followed by a double uri-encoded page title |
| Name | Type | Description |
| format | {pdf, html}? | export format (pdf|html) |
| Name | Value | Description |
| BadRequest | 400 | Invalid input parameter or request body |
| Forbidden | 403 | Read access to the page is required |
| NotFound | 404 | Requested page could not be found |
| Ok | 200 | The request completed successfully |
None
The Content-Disposition, Content-Length, and Content-Type headers provide information about the retrieved file.
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);
}