GetDocumentKeywords API¶
Returns the keywords assigned to a document. Keywords are returned as a comma-separated list inside a single <Keywords> element.
A document carries two kinds of keyword and this API returns both, the ones the user curated first and the generated ones after them. Keywords a user entered are never touched when generated ones are produced or replaced, which is why the two are kept apart.
Changed in 9.0. Earlier builds returned only the user-defined keywords. Keywords generated by infoRouter Connect are now included in the same list. A keyword may also be a phrase of several words, such as
acceptance letter, rather than a single word.
Endpoint¶
Methods¶
-
GET
/srv.asmx/GetDocumentKeywords?AuthenticationTicket=...&Path=... -
POST
/srv.asmx/GetDocumentKeywords(form data) -
SOAP Action:
http://tempuri.org/GetDocumentKeywords
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
AuthenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
Path |
string | Yes | Full infoRouter path to the document (e.g. /Finance/Reports/Q1-Report.pdf), or a short document ID path (~D{id} or ~D{id}.ext). |
Response¶
Success Response¶
Returns a <response> root element containing a <Keywords> child element whose text content is a comma-separated list of all keywords assigned to the document.
| Element / Attribute | Description |
|---|---|
success |
"true" on success. |
error |
Empty string on success. |
<Keywords> |
Comma-separated list of keywords, the user's own first and the generated ones after. Empty text if no keywords are assigned. |
No Keywords Response¶
When the document exists but has no keywords assigned:
Error Response¶
Required Permissions¶
The calling user must have at least read access to the document.
Example¶
GET Request¶
GET /srv.asmx/GetDocumentKeywords
?AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&Path=/Finance/Reports/Q1-2024-Report.pdf
HTTP/1.1
GET Request (short ID path)¶
GET /srv.asmx/GetDocumentKeywords
?AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&Path=~D1051
HTTP/1.1
POST Request¶
POST /srv.asmx/GetDocumentKeywords HTTP/1.1
Content-Type: application/x-www-form-urlencoded
AuthenticationTicket=3f2504e0-4f89-11d3-9a0c-0305e82c3301
&Path=/Finance/Reports/Q1-2024-Report.pdf
SOAP Request¶
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://tempuri.org/">
<soap:Body>
<tns:GetDocumentKeywords>
<tns:AuthenticationTicket>3f2504e0-4f89-11d3-9a0c-0305e82c3301</tns:AuthenticationTicket>
<tns:Path>/Finance/Reports/Q1-2024-Report.pdf</tns:Path>
</tns:GetDocumentKeywords>
</soap:Body>
</soap:Envelope>
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;
}
Reads the keywords stored on a document.
const root = await call('GetDocumentKeywords', {
authenticationTicket: ticket,
Path: '/Finance/Reports/Q1.pdf'
});
const keywords = root.querySelector('Keywords').textContent.split(',');
They come back joined with commas in one element, and a keyword may contain spaces. Storing
alpha and beta gamma reads back as the single string alpha,beta gamma, so split on the comma and
never on the space. A keyword that itself contains a comma cannot be told apart from two keywords.
Notes¶
-
Keywords are returned as a single comma-separated string inside
<Keywords>, not as individual child elements. -
The list holds both kinds of keyword and does not say which is which. Use
UpdateDocumentKeywordsto set the user's own, andGetConnectProfilewithIncludeKeywords=trueto have generated ones produced. -
A keyword may be a phrase and may contain spaces, so split the list on commas rather than on whitespace.
-
If the document has no keywords,
<Keywords>is present but contains empty text. -
Both full infoRouter paths and short document ID paths (
~D{id}or~D{id}.ext) are accepted for thePathparameter.
Related APIs¶
-
GetDocument - Get full document metadata and properties
-
GetDocumentComments - Get all comments attached to a document
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 |
4041 |
no document at that path - including a folder path, and one the caller may not see |
HTTP 400 |
a required string parameter was empty; refused by model binding, so there is no error document |
A call with no ticket signs in as the anonymous user, so a document in a library flagged as anonymous can be read without authenticating.
| Error | Description |
|---|---|
[900] Authentication failed |
Invalid or missing authentication ticket. |
[901] Session expired or Invalid ticket |
The ticket has expired or does not exist. |
| Document not found | The specified path does not resolve to an existing document. |
SystemError:... |
An unexpected server-side error occurred. |