Allows you to create and manage documents, as well as manage access to your documents via shares.
npm install @dynatrace-sdk/client-document

This API allows you to create and manage documents, as well as manage access to them.
Have a look at the service documentation to familiarize yourself with its key concepts.
Note, that the document's content isn't inspected by the document-store, therefore it can be entirely schemaless. If your content adheres to a schema, it's your responsibility to enforce that.
Information about authorization can be found here.
There are 2 different permission mechanisms. Most operations involve both mechanisms.
document:documents:read) guard endpoints. If the user doesn't have the permission required by an endpoint, the request gets rejected.These permissions can not be modified via the doc-store API.
They can be modified via the API, e.g. by using the sharing endpoints.
Therefore, a user needs to have access both in the DT IAM layer (by having specific IAM permissions) as well as access to the specific documents (e.g. by being document owner).
By default, documents are only accessible to their owner. There are 3 ways of sharing documents.
Documents can be made public (via the updateDocument operation) by the owner. This immediately grants read access to all users in the environment.
Environment-Shares grant read or read-write access to users of the same environment, but users need to actively claim the share.
The owner effectively loses control over who exactly gains access, as any user can claim the share and therefore receive access.
Direct-Shares immediately grant read or read-write access to specific users and groups. The owner is in total control of who exactly receives access, and can also revoke access retrospectively.
By default, every user with write-access to a document is allowed to re-share it via direct-shares and environment-shares. The owner can disable this by setting the isReshareable property to false (via the updateDocument operation).
The sharing mechanisms are not mutually exclusive - a document can be shared via multiple sharing mechanisms at the same time.
Document ownership can be changed via the transferDocumentOwner operation.
Operations which modify a document generally use mandatory optimistic locking.
When such operations are executed, the user must provide the version upon which they operate.
If the document version in the service doesn't match, because the document has been modified in the meantime, then the operation gets rejected.
In addition to the mandatory Optimistic Locking, there is optional Active Locking.
Active locking can be optionally utilized to prevent conflicts caused by multiple users concurrently updating the same document.
A user can lock a document to prevent other users from updating the document for some time.
Once the user is done updating the document, they can release the lock and therefore enable updates by other users.
Deleted documents are moved to the trash and permanently deleted after 30 days.
The Trash API can be used to manage deleted documents.
Restoring a deleted document makes the document accessible again for the owner as well as all users who had previously received access via shares.
Document snapshots allow to reset a document's content back to an earlier state.
Snapshots must be explicitly created when updating the document. Multiple snapshots can be created per document.
Restoring a snapshot means that the document's content gets changed to the state it had when the snapshot was originally created. It doesn't change access-related data like the document's shares or ownership.
Snapshot creation is rate-limited to 5 snapshots per 60 seconds per document.
The maximum amount of snapshots per document is 50. Additional snapshots result in the deletion of the oldest existing snapshot.
All snapshots get automatically deleted after 30 days.
All users with read access to a document may read its snapshots.
All users with write access to a document may create snapshots of it.
Only the owner may restore or delete a snapshot.
Each document is assigned a unique and immutable identifier (id) at the time of creation.
This identifier may be supplied by the user. If the user doesn't provide one, the system will generate it automatically.
Regardless of its origin, the identifier is guaranteed to be unique across all documents and is immutable.
Regular users can only access documents owned by them or shared with them.
Users with the permission document:documents:admin can act with elevated permission - they can access all users' documents of the current environment, regardless of ownership.
The admin-access can be enabled on a per-request basis, by setting the optional request parameter admin-access to true.
No user data like names or email addresses are stored. Instead, SSO ids are persisted.
Every user's last access to every document gets stored to allow ordering of results so that least recently accessed documents appear first.
Some documents are created and maintained by the system itself, instead of being user-owned.
originAppId indicates app ownership.originExtensionId indicates extension ownership.``bash`
npm install @dynatrace-sdk/client-document
- Visit SDK for Typescript guide in the Dynatrace Developer
- Ask a question in the Dynatrace Community
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.
Full API reference for the latest version of the SDK is also available at the Dynatrace Developer.
`js`
import { directSharesClient } from '@dynatrace-sdk/client-document';
Add recipients to a direct-share.
Required scope: document:direct-shares:write
Add one or multiple SSO-users and/or SSO-groups to this share. The affected users immediately gain access to the document.
You can only add recipients to shares which are accessible to you. Shares accessible to you include those of your own documents, as well as those of reshareable documents owned by other users to which you have write access.
The maximum number of recipients is 1000.
The validity of the SSO-users and SSO-groups isn't verified. It's technically possible, albeit pointless, to add non-existing users and groups.
Already added users or groups are ignored.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|204|The recipients have been added.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ShareNotFound|Share not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data =
await directSharesClient.addDirectShareRecipients({
id: "...",
body: {
recipients: [
{
id: "441664f0-23c9-40ef-b344-18c02c23d789",
type: "group",
},
],
},
});
`
Create a direct-share.
Required scope: document:direct-shares:write
Create a direct-share for a document. This is only possible for documents you own, as well as for reshareable documents owned by other users to which you have write access. The share can be used to grant access to a specific set of users and/or groups, via addRecipients.
You can optionally add users and/or groups which will directly be registered as recipients of the share. The users and groups are specified via their sso-ids. The maximum number of recipients is 1000.
The validity of the SSO-users and SSO-groups isn't verified. It's technically possible, albeit pointless, to add non-existing users and groups.
The share can be created with either read or read-write access.
A document can have maximally one direct-share per access type, therefore it's impossible to create multiple read-shares or multiple read-write-shares for a single document.
This means, that you can create one read-share for a document, and this single read-share can be used to give read-access to an arbitrary number of users (and/or groups). The same applies to a read-write-share.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|DirectShare|201|A new share for the specified document has been created.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|ShareAlreadyExists|Share creation failed - a share with the specified permission already exists for the document.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data = await directSharesClient.createDirectShare({
body: {
documentId: "...",
access: "...",
recipients: [
{
id: "441664f0-23c9-40ef-b344-18c02c23d789",
type: "group",
},
],
},
});
`
Delete a direct-share.
Required scope: document:direct-shares:delete
Delete the share. This will not delete the share's document.
You can only delete shares which are accessible to you. Shares accessible to you include those of your own documents, as well as those of reshareable documents owned by other users to which you have write access.
This operation effectively revokes the access of all the share's recipients.
Be aware that deleting a share doesn't necessarily prevent a user from accessing a document, as the user might still have access via another share (of the same document). E.g., if a user has 'read' and 'read-write' access (via one 'read' and another 'read-write' share), and the 'read' share gets deleted, access is still granted to the user via the other 'read-write' share.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|204|The share has been deleted.|
#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ShareNotFound|Share not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data = await directSharesClient.deleteDirectShare({
id: "...",
});
`
Retrieve a direct-share.
Required scope: document:direct-shares:read
Retrieve a direct-share via its id.
The share must be accessible to you. Shares accessible to you include those of your own documents, as well as those of reshareable documents owned by other users to which you have write access.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ShareNotFound|Share not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data = await directSharesClient.getDirectShare({
id: "...",
});
`
List the recipients of a direct-share.
Required scope: document:direct-shares:read
Retrieve a share's recipients. If there are groups among the recipients, the groups always appear before the users.
You can only retrieve the recipients for shares which are accessible to you. Shares accessible to you include those of your own documents, as well as those of reshareable documents owned by other users to which you have write access.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|The page parameter is used to directly access a specific page. The value of the page parameter, if specified, has to be a value greater than zero. If the value of the page parameter exceeds the highest available page on the backend, an empty page is returned.
|The page key is used to query results from the next page. You get a nextPageKey parameter in the return value of this method to use here. If this parameter is omitted, the first page will be returned.
The page size which defines the requested number of result entries. You can request a maximum of 1000 result entries. If this parameter is omitted, the default value of 20 will be used.
|#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ShareNotFound|Share not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data =
await directSharesClient.getDirectShareRecipients({
id: "...",
});
`
List all direct-shares accessible to you.
Required scope: document:direct-shares:read
List all direct-shares accessible to you.
Shares accessible to you include those of your own documents, as well as those of reshareable documents owned by other users to which you have write access. If you are only concerned with a specific document's shares, or a specific share, you can use the filter parameter to narrow down the result set. If you attempt to retrieve shares which are not accessible to you the result set will be empty.
Note, that at the moment we offer a naive pagination, and therefore interim mutations can lead to result inconsistencies (such as duplicates, missing entries).
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|documentId property, and only with the equals operator. Via this you can effectively retrieve the direct-shares of a specific document. If this parameter is omitted, all direct-shares accessible to you will be returned. |The page parameter is used to directly access a specific page. The value of the page parameter, if specified, has to be a value greater than zero. If the value of the page parameter exceeds the highest available page on the backend, an empty page is returned.
|The page key is used to query results from the next page. You get a nextPageKey parameter in the return value of this method to use here. If this parameter is omitted, the first page will be returned.
The page size which defines the requested number of result entries. You can request a maximum of 1000 result entries. If this parameter is omitted, the default value of 20 will be used.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|DirectShareList|200|A list of direct-shares accessible to you.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data = await directSharesClient.listDirectShares();
`
Remove recipients from a share.
Required scope: document:direct-shares:write
Remove one or multiple recipients from the share. The affected users immediately lose access to the document.
You can only remove recipients from shares which are accessible to you. Shares accessible to you include those of your own documents, as well as those of reshareable documents owned by other users to which you have write access.
The maximum number of recipients is 1000.
Non-existing users or groups are ignored.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|204|The recipients have been removed.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ShareNotFound|Share not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { directSharesClient } from "@dynatrace-sdk/client-document";
const data =
await directSharesClient.removeDirectShareRecipients({
id: "...",
body: { ids: ["..."] },
});
`
`js`
import { documentLockingClient } from '@dynatrace-sdk/client-document';
Acquire the lock on the document.
Required scope: document:documents:write
Acquire the lock on the document. A user can lock a maximum of five documents at any given time. Once the lock is acquired by the user, other users cannot make any updates to the document.
The user acquiring the lock can optionally specify the duration for which the lock can be attained. However, the specified duration must not exceed the maximum allowed duration of 15 minutes. If not specified, the lock is acquired for 10 minutes.
If the user who has currently locked the document attempts to acquire the lock for the same document again, the duration of the lock gets extended by the specified duration or by a default duration of 10 minutes, if not specified.
The other users would not be allowed to acquire the lock on an already locked document.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.body*required|AcquireLock| |
|config.id*required|string|System-generated or user-given id of a document. |
#### Returns
| Return type | Status code | Description |
|---|---|---|
|AcquireLockResult|200|The lock has been acquired by the user.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|DocumentAlreadyLocked|Lock acquisition failed as the document is already locked.|
|LockedDocumentsLimitReached|Lock acquisition failed as number of locked documents reached or exceeded the allowed limit.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentLockingClient } from "@dynatrace-sdk/client-document";
const data = await documentLockingClient.acquireLock({
id: "...",
body: { documentVersion: 10 },
});
`
Inspect whether the document is locked.
Required scope: document:documents:read
Inspect whether the document is locked.
This provides the information about whether the document is locked and the user that currently owns the lock.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.id*required|string|System-generated or user-given id of a document. |
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentLockingClient } from "@dynatrace-sdk/client-document";
const data = await documentLockingClient.inspectLock({
id: "...",
});
`
Release the lock on the document.
Required scope: document:documents:write
Release the lock on the document.
The lock on the document can be released only by the user who owns it.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.id*required|string|System-generated or user-given id of a document. |
#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|200|The lock on the document has been released.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentLockingClient } from "@dynatrace-sdk/client-document";
const data = await documentLockingClient.releaseLock({
id: "...",
});
`
`js`
import { documentsClient } from '@dynatrace-sdk/client-document';
Bulk-delete multiple documents
Required scope: document:documents:delete
Move the documents with the given ids into the trash. They are no longer accessible until they're restored from the trash. <p>The number of provided document ids is limited to 100.</p>
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.bulkDeleteDocument({
body: { ids: ["..."] },
});
`
Create a new document.
Required scope: document:documents:write
Create a new document. You are the owner of the created document. The document isn't accessible to other users.
The document's name and type must be provided. These two properties can later be used for filtering purposes, when listing accessible documents.
Be aware, that the type isn't the same as the Content-Type of the document, but instead adds user-defined semantics of which the document-store is entirely agnostic.
The content size must not exceed 50 MB.
#### Parameters
| Name | Type |
| --- | --- |
|config.body*required|CreateDocumentBody|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|ExternalIdAlreadyExists|Deprecated, replaced by IdAlreadyExists. A document with the given external id already exists in this environment.|
|DocumentTooLarge|Maximum content size exceeded.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
|InsufficientStorage|The storage quota or maximum number of documents has been exceeded.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.createDocument({
body: { name: "...", type: "...", content: "..." },
});
`
Delete the document
Required scope: document:documents:delete
Move the document into the trash. It is no longer accessible until it's restored from the trash.
Optimistic locking is enforced via the optimistic-locking-version parameter.
You must own the document to delete it.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|Conflict|Optimistic locking failed, or the document is actively locked by another user, or some other conflict.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.deleteDocument({
id: "...",
optimisticLockingVersion: "...",
});
`
Delete the snapshot.
Required scope: document:documents:write
Irrevocably delete the snapshot. Only the document owner may do this.
This operation doesn't affect the current state of the document.
Instead, it prevents that the document may ever be restored to the state it had when the snapshot was created.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|204|The snapshot has been deleted.|
#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|SnapshotNotFound|Snapshot not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.deleteSnapshot({
id: "...",
snapshotVersion: 10,
});
`
Download document content
Required scope: document:documents:read
Download latest document content.
If the snapshot-version param is provided, the content of the specified snapshot gets returned instead. This requires write-access to the document.
The document must be accessible to you - therefore, you must either own it or you have received access through sharing.
The response's Content-Type header has the same value that has been used during the upload.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|filename query parameter can be passed to give the file that's being downloaded a user-provided name and file extension for downloading purposes. This name will be sent back to the client via the Content-Disposition HTTP header. The passed filename will be trimmed so that it doesn't contain any space characters around the name. When the filename isn't specified, then the name of the document is used as file name and no extension is added, since the service isn't aware of file extensions. |#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentOrSnapshotNotFound|Document or snapshot not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.downloadDocumentContent({
id: "...",
});
`
Retrieve metadata and content.
Required scope: document:documents:read
Return metadata and content in one multipart response.
If the snapshot-version param is provided, the metadata and content of the specified snapshot gets returned instead. This requires write-access to the document.
The document must be accessible to you - therefore, you must either own it or you have received access through sharing.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.addFields|string|
Comma-separated list of field names that are added to the default set of fields. You can include the following additional fields:
userContext.lastAccessedTimemodificationInfo.lastModifyingAppIdIndicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|filename query parameter can be passed to give the file that's being downloaded a user-provided name and file extension for downloading purposes. This name will be sent back to the client via the Content-Disposition HTTP header. The passed filename will be trimmed so that it doesn't contain any space characters around the name. When the filename isn't specified, then the name of the document is used as file name and no extension is added, since the service isn't aware of file extensions. |#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentOrSnapshotNotFound|Document or snapshot not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.getDocument({
id: "...",
});
`
Retrieve document metadata.
Required scope: document:documents:read
Retrieve a document's metadata.
The document must be accessible to you - therefore, you must either own it or you have received access through sharing.
If the snapshot-version param is provided, the metadata of the specified snapshot gets returned instead. This requires write-access to the document.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.addFields|string|
Comma-separated list of field names that are added to the default set of fields. You can include the following additional fields:
userContext.lastAccessedTimemodificationInfo.lastModifyingAppIdIndicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentOrSnapshotNotFound|Document or snapshot not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.getDocumentMetadata({
id: "...",
});
`
Retrieve snapshot metadata.
Required scope: document:documents:read
Retrieve snapshot metadata. Requires write-access to the document.
This doesn't return data of the snapshotted document, instead it returns data about the snapshot itself.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|SnapshotNotFound|Snapshot not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.getSnapshotMetadata({
id: "...",
snapshotVersion: 10,
});
`
List all documents accessible to you.
Required scope: document:documents:read
List the metadata of all documents accessible to you.
This includes your own documents, as well as other users' documents which have been shared with you.
*Note, that at the moment we offer a naive pagination, and therefore interim document mutations and/or an
insufficient sort clause, if provided, can lead to result inconsistencies (such as duplicates, missing entries).*
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.addFields|string|
Comma-separated list of field names that are added to the default set of fields. You can include the following additional fields:
descriptionuserContext.lastAccessedTimeoriginExtensionIdshareInfo.isSharedshareInfo.isSharedWithCurrentUserIndicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|The filter parameter, as explained here.
If this parameter is omitted, no filtering is applied and all documents available to you will be returned.
Filtering by string type parameters (name, type) when using one of the operators contains, starts-with and ends-with is case insensitive.
Filtering by id using the operators contains, starts-with and ends-with is only supported in case of user-given document ids.
When using the equals operator or the not-equals operator, filtering is case sensitive.
The following fields are legal filtering parameters - any other field names will result in a HTTP 400 response:
id, name, type, version, owner, modificationInfo.createdTime, modificationInfo.createdBy, modificationInfo.lastModifiedTime, modificationInfo.lastModifiedBy, originAppId, originExtensionId
The following constraints apply:
Parameter names are case-sensitive.
Maximum nesting depth (via brackets) is 3.
Maximum length is 1024 characters.
Examples:
name = 'my-document-name'
name == 'my-document-name'
(name starts-with 'awesome' or type != 'dashboard') and version >= 5
modificationInfo.lastModifiedTime >= '2022-07-01T00:10:05.000Z' and not (name contains 'new')
originAppId exists
originExtensionId exists
The page parameter is used to directly access a specific page. The value of the page parameter, if specified, has to be a value greater than zero. If the value of the page parameter exceeds the highest available page on the backend, an empty page is returned.
|The page key is used to query results from the next page. You get a nextPageKey parameter in the return value of this method to use here. If this parameter is omitted, the first page will be returned.
The page size which defines the requested number of result entries. You can request a maximum of 1000 result entries. If this parameter is omitted, the default value of 20 will be used.
|The sort parameter, as explained here
If this parameter is omitted, the documents are sorted by their ids.
Sorting by string types (name, type) is done in a case insensitive manner.
The following fields are legal sorting parameters - any other sorting parameters will result in a HTTP 400 response:
name, type, version, owner, modificationInfo.createdTime, modificationInfo.createdBy, modificationInfo.lastModifiedTime,modificationInfo.lastModifiedBy,originAppId, userContext.lastAccessedTimeThe following constraints apply:
Maximum number of sorting parameters is 5. Exceeding this limit will result in a HTTP 400 response.
Note that blanks are not ignored and will result in a HTTP 400 response.
Examples:
name
name,-type,modificationInfo.lastModifiedTime
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.listDocuments();
`
List all snapshots of the document
Required scope: document:documents:read
Returns metadata of all snapshots of the document, in descending order of the snapshot's creation date. Requires write-access to the document.
You can apply pagination via the pageKey and pageSize parameters.
Note, that at the moment we offer a naive pagination, and therefore interim mutations can lead to result inconsistencies (such as duplicates, missing entries).
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|The page parameter is used to directly access a specific page. The value of the page parameter, if specified, has to be a value greater than zero. If the value of the page parameter exceeds the highest available page on the backend, an empty page is returned.
|The page key is used to query results from the next page. You get a nextPageKey parameter in the return value of this method to use here. If this parameter is omitted, the first page will be returned.
The page size which defines the requested number of result entries. You can request a maximum of 1000 result entries. If this parameter is omitted, the default value of 20 will be used.
|#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.listSnapshots({
id: "...",
});
`
Restore the snapshot.
Required scope: document:documents:write
Reset the document to the state it had when the snapshot was created. Requires write-access to the document.
If no snapshot of the current document state exists, then a new snapshot is created
before restoring the selected snapshot.
If the document has more than 50 snapshots, its oldest snapshot gets automatically deleted.
This operation only changes the document's content. It doesn't change ownership or access/sharing data.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|#### Throws
| Error Type | Error Message |
|---|---|
|Unauthorized|API token or tenant missing or corrupt.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentOrSnapshotNotFound|Document or snapshot not found.|
|Conflict|Optimistic locking failed, or the document is actively locked by another user, or some other conflict.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.restoreSnapshot({
id: "...",
snapshotVersion: 10,
});
`
Transfers ownership of the document to a new owner.
Required scope: document:documents:write
Transfers ownership of the document to a new owner. The previous owner loses access to the document. This operation can only be performed by the document owner.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with elevated permissions - additionally requires document:documents:admin.
If provided, the user effectively operates as owner of all documents. This isn't supported for ready-made documents.
|
#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|204|Ownership has been transferred successfully.|
#### Throws
| Error Type | Error Message |
|---|---|
|BadRequest|Malformed request or invalid parameters.|
|Forbidden|Access forbidden. This usually happens because the user lacks the permission to access the specific endpoint, or because the target entity isn't accessible to the user.|
|DocumentNotFound|Document not found.|
|Conflict|Optimistic locking failed, or the document is actively locked by another user, or some other conflict.|
|InternalServerError|There is a problem in the backend.|
|ServiceUnavailable|There is a temporary problem in the backend.|
Code example
`ts
import { documentsClient } from "@dynatrace-sdk/client-document";
const data = await documentsClient.transferDocumentOwner({
id: "...",
body: { newOwnerId: "..." },
});
``
Update metadata and content. Optionally, create a snapshot.
Required scope: document:documents:write
Update metadata and/or the content of the document.
Name, type, and content must be non-empty. Name, type, content, isPrivate and isReshareable are optional, but at least one of them must be provided.
The document must be accessible to you - therefore, you must either own it or you have received access through sharing.
As part of this operation, you can optionally create a snapshot of the updated document.
In that case, if the document has more than 50 snapshots, its oldest snapshot gets automatically deleted.
It's impossible to create more than 5 snapshots per 60 seconds, per document.
#### Parameters
| Name | Type | Description |
| --- | --- | --- |
|config.adminAccess|boolean|
Indicates whether the operation should be performed with el