In this section, we explore the following:
You can retrieve (the configuration of) a specific document to parse something from its metadata (or just confirm it exists) if you have its documentId
.
⭑ Note: As always, you can look for the file in the UI as well. If for whatever reason it does not appear there after you’ve created a new document, it might be because of the way your Views are set up. Go to your Library administration page, go to Views, and select the checkbox called “View documents from other classes”.
Play with the API Explorer:
Only documentId
is mandatory, and it must be an AODocs documentId
not a Drive fileId
.
GET https://aodocs.altirnao.com/api/document/v1/RnTzVT28x5Sb48h3vSQ
If you need only some of the fields of the extensive ApiDocument resource to come back, you can specify them in the fields
array field of the request and sending this list as a query parameter. For example, you might want to request only the library name, class name, library ID, class ID, document ID, title, and the document description.
GET https://aodocs.altirnao.com/api/document/v1/RnTzVT28x5Sb48h3vSQ?fields=libraryName%2CclassName%2ClibraryId%2CclassId%2Cid%2Ctitle%2CrichText
⭑ Note: To get an AODocs document (including its
documentId
) by the Drive ID of one of its attachments, use theGET /document/v1/drive/{driveId}
method.
The response returns an ApiDocument resource, listing the document associated with the provided document ID. The document’s ID is id
, and its class is what you specified in the request, else of the library’s default type.
{
"kind": "aodocs#document",
"libraryName": "my-DMS-lib-001",
"className": "my-dms-class-002",
"libraryId": "RnTG8PDu8ZqTuDVHcv",
"classId": "RnTf1mx35gaTJLzoFp",
"id": "RnTzVT28x5Sb48h3vSQ", <— documentId
"title": "my-dms-doc-002",
"richText"": "",
...
}
⭑ Note: This is available only to library administrators.
You can list documents associated with a particular library as follows.
Play with the API Explorer:
libraryId
is a path parameter. It is the only mandatory parameter.
POST https://aodocs.altirnao.com/api/search/v1/libraries/Rs511XR8xAxGXu7nZYj/list
The response returns an ApiDocumentList resource, listing all documents associated with the specified library.
{
"kind": "aodocs#documentList",
"documentList": [
{
"kind": "aodocs#document",
"libraryName": "my-DMS-lib-001",
"className": "my-dms-class-002",
"libraryId": "RnTG8PDu8ZqTuDVHcv",
"classId": "RnTf1mx35gaTJLzoFp",
"id": "RnTzVT28x5Sb48h3vSQ", <— documentId
"title": "my-dms-doc-002",
"richText"": "",
...
}
...
{
"kind": "aodocs#document",
...
}
]
}
⭑ Note: This is available only to library administrators.
You can count the number of documents associated with a particular library (and optionally class) as follows.
Play with the API Explorer:
libraryId
is a path parameter. It is the only mandatory parameter. However, using the classId
helps narrow the response to documents of a specific class you want.
POST https://aodocs.altirnao.com/api/search/v1/libraries/RrVcEFb8wtDeNAnlmNN/count?classId=RrVcdN280MKJwPyE7sh
The response returns an ApiDocumentCount resource, giving a count of all documents associated with the specified library (and class if you specified the classId
).
{
"kind": "aodocs#documentCount",
"count": 12
}
You can search for documents associated with a particular library and a particular class as follows.
Play with the API Explorer:
This method searches documents of a class matching the provided query. It might become very slow or time out when iterating over many pages of results. If the result set contains more than 10,000 documents, it’s highly likely the response will get truncated and some results will be missing. You should always check if precision=INCOMPLETE_RESULT
in the response.
⭑ Note: By default, the method includes attachments in the search. You can exclude searching in attachments by setting the
searchInAttachments
parameter tofalse
.
libraryId
is a path parameter and classId
is a query parameter. These are the only mandatory arguments. However, the searchQuery
query parameter is what ultimately determines what results come back, filtering them on a text string.
⭑ Note: If you want to search for a specific phrase as a singular whole, put double quotes around the phrase being passed as a
searchQuery
query parameter. For example, if your document is called “big blue document”, then sending “big blue” or “blue document” (with the double quotes) as thesearchQuery
query parameter finds it, but “big document” does not.
POST https://aodocs.altirnao.com/api/search/v1/libraries/RrVWqiT8059P4t8aVYI/search?classId=RrVWtjs801GlsyxIDJe&searchQuery=%22blue%20document%22
The response returns an ApiSearchResult resource, listing all documents that match the specified query.
{
"kind": "aodocs#documentList",
"documentList": [
{
"kind": "aodocs#document",
"libraryName": "my-DMS-lib-001",
"className": "my-dms-class-002",
"libraryId": "RrVWqiT8059P4t8aVYI",
"classId": "RrVWtjs801GlsyxIDJe",
"id": "RnTzVT28x5Sb48h3vSQ", <— documentId
"title": "big blue document",
...
}
...
]
}