CreateHtmlDocument API¶
Creates a new HTML document in the specified folder. The HTML content is stored in the document's MetaTag field as an XML-encoded form data structure, which is the native infoRouter format for HTML form documents.
Endpoint¶
Methods¶
- GET
/srv.asmx/CreateHtmlDocument?authenticationTicket=...&folderPath=...&name=...&htmlContent=...&xmlParameters=... - POST
/srv.asmx/CreateHtmlDocument(form data) - SOAP Action:
http://tempuri.org/CreateHtmlDocument
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
authenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
folderPath |
string | Yes | Full infoRouter path of the destination folder (e.g. /Finance/Reports). |
name |
string | Yes | Document name. The .htm extension is appended automatically if the name does not already end with .htm or .html. |
htmlContent |
string | Yes | Raw HTML body text to store as the document content. |
xmlParameters |
string | Yes | XML document of upload options. Required by model binding even when empty - send <parameters /> for none. Malformed XML here is refused with 4000. See format below. |
xmlParameters Format¶
The xmlParameters value is an XML string. The root element is <xmlparameters> and each option is an <item> element with NAME and VALUE attributes:
<xmlparameters>
<item NAME="DESCRIPTION" VALUE="Q1 financial summary"/>
<item NAME="KEYWORDS" VALUE="finance quarterly"/>
<item NAME="VERSIONCOMMENT" VALUE="Initial draft"/>
<item NAME="CHECKOUT" VALUE="TRUE"/>
<item NAME="PUBLISHOPTION" VALUE="Publish"/>
<item NAME="SENDEMAILS" VALUE="true"/>
<item NAME="CREATIONDATE" VALUE="2025-01-15"/>
<item NAME="MODIFICATIONDATE" VALUE="2025-01-15"/>
<item NAME="MPVERSIONMAJOR" VALUE="1"/>
<item NAME="MPVERSIONMINOR" VALUE="0"/>
<item NAME="MPVERSIONREVISION" VALUE="0"/>
</xmlparameters>
All NAME values are case-insensitive. If VALUE is omitted the element's inner text is used instead.
Supported Parameter Names¶
| Name | Type | Description |
|---|---|---|
DESCRIPTION |
string | Document description. Maximum 4000 characters; a longer value is refused with 4000. |
KEYWORDS |
string | Comma-separated user-defined keywords. A keyword may be a phrase ("acceptance letter"); spaces do not separate keywords. Each keyword takes 128 characters; a longer one is refused with 4000. |
VERSIONCOMMENT |
string | Comment attached to the first document version. |
CHECKOUT |
bool (true/false) |
Lock document immediately after creation. |
PUBLISHOPTION |
enum | Controls publishing after creation. Values: ServerDefault, Publish, DontPublish. Defaults to ServerDefault. |
SENDEMAILS |
bool (true/false) |
Whether to send subscription notification emails to folder subscribers. Default: true. |
CREATIONDATE |
DateTime | Override the document creation date (e.g. 2025-01-15). |
MODIFICATIONDATE |
DateTime | Override the document modification date (e.g. 2025-01-15). |
MPVERSIONMAJOR |
short | Manual version major number (1–2400). |
MPVERSIONMINOR |
short | Manual version minor number (0–999). |
MPVERSIONREVISION |
short | Manual version revision number (0–999). |
PublishOption Values¶
| Value | Behaviour |
|---|---|
ServerDefault |
Applies the folder's configured publishing rule. |
Publish |
Forces the new document to be published immediately. |
DontPublish |
Saves the document without publishing it. |
Response¶
Success Response¶
| Attribute | Description |
|---|---|
documentId |
Integer ID of the newly created document. |
Error Response¶
Required Permissions¶
The calling user must have Add Document permission on the destination folder.
Document Format¶
infoRouter HTML documents store their content as XML in the document's MetaTag field rather than as a binary file. The API wraps the provided htmlContent in the standard infoRouter form data XML structure:
This format is compatible with the infoRouter HTML document editor and can be read back using GetDocumentAbstract.
Example¶
Request (POST)¶
POST /srv.asmx/CreateHtmlDocument HTTP/1.1
Content-Type: application/x-www-form-urlencoded
authenticationTicket=abc123&folderPath=/Finance/Reports&name=Q1Summary&htmlContent=<h1>Q1 Summary</h1><p>Results were positive.</p>&xmlParameters=<xmlparameters><item NAME="DESCRIPTION" VALUE="Q1 financial summary"/><item NAME="SENDEMAILS" VALUE="false"/><item NAME="PUBLISHOPTION" VALUE="Publish"/></xmlparameters>
Request (GET)¶
GET /srv.asmx/CreateHtmlDocument?authenticationTicket=abc123&folderPath=/Finance/Reports&name=Q1Summary&htmlContent=<h1>Q1</h1>&xmlParameters=<xmlparameters><item NAME="DESCRIPTION" VALUE="Summary"/></xmlparameters>
Minimal Request (no xmlParameters)¶
GET /srv.asmx/CreateHtmlDocument?authenticationTicket=abc123&folderPath=/Finance/Reports&name=Q1Summary&htmlContent=<h1>Q1</h1>&xmlParameters=
JavaScript¶
Every call answers XML with HTTP 200, success or not, so success is the thing to branch on and
errorCode is the number to report.
async function call(action, params) {
const response = await fetch(`/srv.asmx/${action}?${new URLSearchParams(params)}`);
const root = new DOMParser()
.parseFromString(await response.text(), 'text/xml')
.documentElement;
if (root.getAttribute('success') !== 'true') {
throw new Error(`${root.getAttribute('errorCode')}: ${root.getAttribute('error')}`);
}
return root;
}
Creates a document from HTML held in the request rather than from an uploaded file.
const root = await call('CreateHtmlDocument', {
authenticationTicket: ticket,
folderPath: '/Finance/Reports',
name: 'summary.htm',
htmlContent: '<html><body><h1>Q3</h1></body></html>',
xmlParameters:
'<parameters>' +
'<parameter Name="DESCRIPTION" Value="Q3 summary" />' +
'<parameter Name="KEYWORDS" Value="quarterly,finance" />' +
'</parameters>'
});
console.log(root.getAttribute('documentId'));
xmlParameters is required even when there are no parameters. It is declared as a non-nullable
string on the REST action, so an empty one is refused by model binding with HTTP 400 before the
operation runs. Send <parameters /> to mean "none". A parameter name the operation does not
recognise is ignored rather than refused.
The boolean parameters take English words only. CHECKOUT and the other switches accept ON,
TRUE, T, YES, Y, 1 and OFF, FALSE, F, NO, N, 0. The message raised when a value
is none of those is translated into the caller's language and lists the translated words, so a
caller reading the answer in German or Turkish is told to send words the parser will not accept.
Ignore the list in the message and send one of the English words above.
Notes¶
- The
.htmextension is appended tonameautomatically if the name has no HTML extension. For example,Q1SummarybecomesQ1Summary.htm. - Parameter names in
xmlParametersare case-insensitive. - If
xmlParametersis empty or omitted, server defaults apply for all options. - Special XML characters in
htmlContent(such as<,>,&) are escaped automatically before storage.
Related APIs¶
- GetDocumentAbstract — Retrieve the stored HTML content of an HTML form document.
- CreateURL — Create a URL shortcut document.
- UploadDocument — Upload a binary document file.
- CreateFolder — Create a folder to hold HTML documents.
Error Codes¶
The errorCode values this operation returns, checked against a running server:
errorCode |
When |
|---|---|
4010 |
the ticket is expired or unknown, or there is no ticket at all - the anonymous user is told "Anonymous users cannot perform this action" |
4090 |
a document of that name is already in the folder |
4041 |
no folder at folderPath |
4000 |
a boolean parameter such as CHECKOUT carried a value that is not one of the English words listed above |
HTTP 400 |
xmlParameters was empty; it is required, so send <parameters /> |
4000 |
the document was not well-formed XML; the message carries the parser's own words |