Skip to main content

Document

Overview

This API allows you to create and manage documents, as well as manage access to your documents via shares.

Have a look at the service documentation to familiarize yourself with its key concepts.

Note, that the document's content is not 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.

Document Sharing

By default, documents are only accessible to their owner. To enable collaboration with other users, you can share the documents with other users.

There are 2 ways of sharing documents.

Environment-Shares allow to share a document with potentially all users in the environment. The owner effectively loses control over who exactly gains access, as any user can claim the share and therefore receive access.

Direct-Shares allow to share a document with specific users and groups. The owner is in total control of who exactly receives access, and can also revoke access retrospectively.

The sharing mechanisms are not mutually exclusive - a document can be shared via multiple sharing mechanisms at the same time.

Document Locking

Document locking can be optionally utilized to prevent conflicts caused by multiple users concurrently updating the same document.

The 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.

Deletion & Restoration

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.

npm install @dynatrace-sdk/client-document

directSharesClient

import { directSharesClient } from "@dynatrace-sdk/client-document";

addDirectShareRecipients

directSharesClient.addDirectShareRecipients(config): Promise<void>

Add recipients to the 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.

Only share's owner is permitted to do this. The maximum number of recipients is 1000.

The validity of the SSO-users and SSO-groups is not verified. It's technically possible, albeit pointless, to add non-existing users and groups.

Already added users or groups are ignored.

Parameters

NameTypeDescription
config.body*requiredAddDirectShareRecipients
config.id*requiredstringSystem-generated unique id, generated during creation of the share.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.addDirectShareRecipients({
id: "...",
body: {
recipients: [
{
id: "441664f0-23c9-40ef-b344-18c02c23d789",
type: "group",
},
],
},
});

createDirectShare

directSharesClient.createDirectShare(config): Promise<DirectShare>

Create a direct-share for one of your own documents.

Required scope: document:direct-shares:write

Create a direct-share for a document owned by you. 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 is not 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 not possible 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

NameType
config.body*requiredCreateDirectShare

Returns

A new share for the specified document has been created.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.createDirectShare({
body: {
documentId: "...",
access: "...",
recipients: [
{
id: "441664f0-23c9-40ef-b344-18c02c23d789",
type: "group",
},
],
},
});

deleteDirectShare

directSharesClient.deleteDirectShare(config): Promise<void>

Delete one of your direct-shares.

Required scope: document:direct-shares:delete

Delete the share. This will not delete the share's document.

You can only delete shares of your own documents.

This operation effectively revokes the access of all of the share's recipients.

Be aware that deleting a share does not 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

NameTypeDescription
config.id*requiredstringSystem-generated unique id, generated during creation of the share.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.deleteDirectShare({
id: "...",
});

getDirectShare

directSharesClient.getDirectShare(config): Promise<DirectShare>

Retrieve one of your direct-shares.

Required scope: document:direct-shares:read

Retrieve a direct-share via its id.

Only the share's owner is permitted to do this.

Parameters

NameTypeDescription
config.id*requiredstringSystem-generated unique id, generated during creation of the share.

Returns

A direct-share.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.getDirectShare({
id: "...",
});

getDirectShareRecipients

directSharesClient.getDirectShareRecipients(config): Promise<DirectShareRecipientList>

List the recipients of one of your direct-shares.

Required scope: document:direct-shares:read

Retrieve a share's recipients. If there are groups among the recipieints, the groups always appear before the users.

Only share's owner is permitted to do this.

Parameters

NameTypeDescription
config.id*requiredstringSystem-generated unique id, generated during creation of the share.

Returns

A list of recipients of the direct-share.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.getDirectShareRecipients({
id: "...",
});

listDirectShares

directSharesClient.listDirectShares(config): Promise<DirectShareList>

List your direct-shares.

Required scope: document:direct-shares:read

List all shares of your documents.

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. This does not circumvent the restriction of being able to only get shares of your own documents. If you attempt to retrieve shares of another user's document, the result set will be empty.

Note, that at the moment we offer a naïve pagination, and therefore interim mutations can lead to result inconsistencies (such as duplicates, missing entries).

Parameters

NameTypeDescription
config.filterstringThe filter query, as explained here. Filtering is only possible on the documentId property, and only with the equals operator. Via this you can effectively request all shares of a specific document owned by you. If this parameter is omitted, all direct-shares of this user will be returned.
config.pagenumber

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.

config.pageKeystring

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.

config.pageSizenumber

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

A list of your direct-shares.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.listDirectShares();

removeDirectShareRecipients

directSharesClient.removeDirectShareRecipients(config): Promise<void>

Remove recipients from the share.

Required scope: document:direct-shares:write

Remove one or multiple recipients from the share. The affected users immediately lose access to the document.

Only share's owner is permitted to do this. The maximum number of recipients is 1000.

Non-existing users or groups are ignored.

Parameters

NameTypeDescription
config.body*requiredRemoveDirectShareRecipients
config.id*requiredstringSystem-generated unique id, generated during creation of the share.

Code example

import { directSharesClient } from "@dynatrace-sdk/client-document";

const data = await directSharesClient.removeDirectShareRecipients({
id: "...",
body: { ids: ["..."] },
});

documentLockingClient

import { documentLockingClient } from "@dynatrace-sdk/client-document";

acquireLock

documentLockingClient.acquireLock(config): Promise<AcquireLockResult>

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

NameTypeDescription
config.body*requiredAcquireLock
config.id*requiredstringDocument id.

Returns

The lock has been acquired by the user.

Code example

import { documentLockingClient } from "@dynatrace-sdk/client-document";

const data = await documentLockingClient.acquireLock({
id: "...",
body: { documentVersion: 10 },
});

inspectLock

documentLockingClient.inspectLock(config): Promise<DocumentLockDetails>

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

NameTypeDescription
config.id*requiredstringDocument id.

Returns

Lock details for a document.

Code example

import { documentLockingClient } from "@dynatrace-sdk/client-document";

const data = await documentLockingClient.inspectLock({
id: "...",
});

releaseLock

documentLockingClient.releaseLock(config): Promise<void>

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

NameType
config.id*requiredstring

Code example

import { documentLockingClient } from "@dynatrace-sdk/client-document";

const data = await documentLockingClient.releaseLock({
id: "...",
});

documentsClient

import { documentsClient } from "@dynatrace-sdk/client-document";

createDocument

documentsClient.createDocument(config): Promise<DocumentMetaData>

Create a new document.

Required scope: document:documents:write

Create a new document which is then owned by you (the user specified by the provided Authorization header). The document is not 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 is not 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

NameType
config.body*requiredCreateDocumentBody

Returns

A new document has been created.

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.createDocument({
body: { name: "...", type: "...", content: "..." },
});

deleteDocument

documentsClient.deleteDocument(config): Promise<void>

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 in order to delete it.

Parameters

NameTypeDescription
config.id*requiredstringDocument id.
config.optimisticLockingVersion*requiredstringTo protect users from accidental overrides, the current version of the document must match the optimistic locking version parameter - otherwise, this request will fail and the entity is left unchanged.

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.deleteDocument({
id: "...",
optimisticLockingVersion: "...",
});

downloadDocumentContent

documentsClient.downloadDocumentContent(config): Promise<Binary>

Download document content

Required scope: document:documents:read

Download latest document content.

The Content-Type header is set to the same value that has been used during the upload.

The document must be accessible to you - therefore, you must either own it or you have received access through sharing.

Parameters

NameTypeDescription
config.filenamestringThe optional filename query parameter can be passed to give the file that is 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 that it does not contain any space characters around the name. When the filename is not specified, then the name of the document is used as file name and no extension is added, since the service is not aware of file extensions.
config.id*requiredstringDocument id.

Returns

Content of the document

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.downloadDocumentContent({
id: "...",
});

getDocument

documentsClient.getDocument(config): Promise<GetDocumentResponse>

Retrieve metadata and content.

Required scope: document:documents:read

Return metadata and content in one multipart response.

The document must be accessible to you - therefore, you must either own it or you have received access through sharing.

Parameters

NameTypeDescription
config.filenamestringThe optional filename query parameter can be passed to give the file that is 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 that it does not contain any space characters around the name. When the filename is not specified, then the name of the document is used as file name and no extension is added, since the service is not aware of file extensions.
config.id*requiredstringDocument id.

Returns

Metadata and content in a multipart response.

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.getDocument({
id: "...",
});

getDocumentMetadata

documentsClient.getDocumentMetadata(config): Promise<DocumentMetaData>

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.

Parameters

NameTypeDescription
config.id*requiredstringDocument id.

Returns

Metadata of document

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.getDocumentMetadata({
id: "...",
});

listDocuments

documentsClient.listDocuments(config): Promise<DocumentList>

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 naïve 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

NameTypeDescription
config.filterstring

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.

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

The following constraints apply:

  • The exists operator is not supported.

  • Parameter names are case-sensitive.

  • Maximum nesting depth (via brackets) is 3.

  • Maximum length is 256 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')

config.pagenumber

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.

config.pageKeystring

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.

config.pageSizenumber

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.

config.sortstring

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

The 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

Returns

A list of metadata objects of documents which are accessible to you.

Note, that this includes your own documents as well as other users&apos; documents which are shared with you.

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.listDocuments();

updateDocument

documentsClient.updateDocument(config): Promise<UpdateDocumentMetadata>

Update metadata and content.

Required scope: document:documents:write

Update metadata and/or the content of the document.

Name, type and content must be non-empty, but are optional. 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.

Parameters

NameTypeDescription
config.body*requiredUpdateDocumentBody
config.id*requiredstringDocument id.
config.optimisticLockingVersion*requiredstringTo protect users from accidental overrides, the current version of the document must match the optimistic locking version parameter - otherwise, this request will fail and the entity is left unchanged.

Returns

Result of updating metadata &amp; content. Contains document metadata and snapshot metadata.

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.updateDocument({
id: "...",
optimisticLockingVersion: "...",
body: {},
});

updateDocumentContent

documentsClient.updateDocumentContent(config): Promise<DocumentMetaData>

Update document content

Required scope: document:documents:write

Update a document's content, by completely replacing it.

The document must be accessible to you - therefore, you must either own it or you have received access through sharing.

Optimistic locking is enforced via the optimistic-locking-version parameter.

The content size must be greater than 0 and must not exceed 50 MB.

The Content-Type header must be set for the multipart part; it will be used as the (new) content type of the document. Illegal (non-mime-type) content types result in a 400 - Bad Request error.

The Content-Disposition header must be set for the multipart part;

Parameters

NameTypeDescription
config.body*requiredUpdateDocumentContentBody
config.id*requiredstringDocument id.
config.optimisticLockingVersion*requiredstringTo protect users from accidental overrides, the current version of the document must match the optimistic locking version parameter - otherwise, this request will fail and the entity is left unchanged.

Returns

Document content successfully updated

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.updateDocumentContent({
id: "...",
optimisticLockingVersion: "...",
body: { content: "..." },
});

updateDocumentMetadata

documentsClient.updateDocumentMetadata(config): Promise<DocumentMetaData>

Update document metadata

Required scope: document:documents:write

Partially update a document's user-defined metadata. At least one property must be updated, otherwise the operation fails.

The document's content is not affected by this operation.

Optimistic locking is enforced via the optimistic-locking-version parameter.

The document must be accessible to you - therefore, you must either own it or you have received access through sharing.

Parameters

NameTypeDescription
config.body*requiredUpdateDocumentMetadataBody
config.id*requiredstringDocument id.
config.optimisticLockingVersion*requiredstringTo protect users from accidental overrides, the current version of the document must match the optimistic locking version parameter - otherwise, this request will fail and the entity is left unchanged.

Returns

The document has been updated. The updated metadata is returned.

Code example

import { documentsClient } from "@dynatrace-sdk/client-document";

const data = await documentsClient.updateDocumentMetadata({
id: "...",
optimisticLockingVersion: "...",
body: {},
});

environmentSharesClient

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

claimEnvironmentShare

environmentSharesClient.claimEnvironmentShare(config): Promise<EnvironmentShareClaimResult>

Claim another user's environment-share.

Required scope: document:environment-shares:claim

Claim this environment-share, therefore gaining access to the share's document. From thereafter, the document will be accessible to you with the specific permissions defined by the share. You can then access the document as usual, via the same endpoints which you would use to access your own documents.

Claiming your own shares is not possible. You can only claim shares of documents belonging to other users of the same environment.

Once you have claimed access to a document, you can not revoke that access again.

The document's owner can revoke your access by deleting the share. This will effectively revoke the access you have been granted by claiming this share.

You can claim multiple shares of the same document, and each share will grant you different permissions.

Claiming the same share multiple times does not have any effect.

Parameters

NameTypeDescription
config.id*requiredstringShare id.

Returns

You have successfully claimed this share and can now access the document with the granted permissions.

Code example

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

const data = await environmentSharesClient.claimEnvironmentShare({
id: "...",
});

createEnvironmentShare

environmentSharesClient.createEnvironmentShare(config): Promise<EnvironmentShare>

Create an environment-share for one of your own documents.

Required scope: document:environment-shares:write

Create a document share, which can be used to give one or multiple other users access to this document.

This is only possible if you are the owner of the document.

A share can be created with either read or read-write access.

A document can have maximally one share per access type, therefore it's not possible 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. The same applies to a 'read-write'-share.

Creating a share does not automatically allow users to access the document - only those users who explicitly claim the share gain access to the document.

Revoking access from users can be done by deleting the share.

Parameters

NameType
config.body*requiredCreateEnvShare

Returns

A new share for the specified document has been created.

Code example

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

const data = await environmentSharesClient.createEnvironmentShare({
body: { documentId: "...", access: "..." },
});

deleteEnvironmentShare

environmentSharesClient.deleteEnvironmentShare(config): Promise<void>

Delete one of your environment-shares.

Required scope: document:environment-shares:delete

Delete the share. This will not delete the share's document.

Only the share's owner is permitted to do this.

This operation effectively revokes the access which has been granted to all users which have claimed this share. This is the only way to revoke access to your document from other users. It's not possible to revoke access of individual users.

Be aware that deleting a share does not 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 readwrite-access (via one read-share and another readwrite-share), and the read-share gets deleted, access is still granted to the user via the readwrite-share.

Parameters

NameTypeDescription
config.id*requiredstringEnvironment-share id.

Code example

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

const data = await environmentSharesClient.deleteEnvironmentShare({
id: "...",
});

getEnvironmentShare

environmentSharesClient.getEnvironmentShare(config): Promise<EnvironmentShare>

Retrieve one of your environment-shares.

Required scope: document:environment-shares:read

Retrieve a share via its id.

Only the share's owner is permitted to do this.

Parameters

NameTypeDescription
config.id*requiredstringEnvironment-share id.

Returns

An environment-share.

Code example

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

const data = await environmentSharesClient.getEnvironmentShare({
id: "...",
});

getEnvironmentShareClaimers

environmentSharesClient.getEnvironmentShareClaimers(config): Promise<EnvironmentShareClaimerList>

List the claimers of one of your environment-shares.

Required scope: document:environment-shares:read

Retrieve a share's claimers.

Only the share's owner is permitted to do this.

You can control the result'S pagination via the pageKey, page and pageSize parameters.

Note, that at the moment we offer a naïve 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

NameTypeDescription
config.id*requiredstringEnvironment-share id.
config.pagenumber

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.

config.pageKeystring

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.

config.pageSizenumber

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

A list of users who have claimed the environment-share.

Code example

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

const data = await environmentSharesClient.getEnvironmentShareClaimers({
id: "...",
});

listEnvironmentShares

environmentSharesClient.listEnvironmentShares(config): Promise<EnvironmentShareList>

List your environment-shares.

Required scope: document:environment-shares:read

List all environment-shares of your own documents.

If you are only concerned with a specific document's environment-shares, or a specific share, you can use the filter parameter to narrow down the result set. Note, that this does not circumvent the restriction of being able to only get environment-shares of your own documents. If you attempt to retrieve environment-shares of another user's document, the result set will be empty.

Furthermore, you can apply pagination via the pageKey, page and pageSize parameters.

Note, that at the moment we offer a naïve pagination, and therefore interim mutations can lead to result inconsistencies (such as duplicates, missing entries).

Parameters

NameTypeDescription
config.filterstringThe filter query, as explained here. Filtering is only possible on the documentId property, and only via the equals operator. Via this you can effectively request all shares of a specific document owned by you. If this parameter is omitted, all environment-shares of this user will be returned.
config.pagenumber

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.

config.pageKeystring

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.

config.pageSizenumber

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

A list of your environment-shares. If the list was paginated (see pageKey, page and pageSize), and there are more environment-shares available, you will find a non-empty nextPageKey which can be used for a follow-up query. The totalCount property will let you know the number of all matching environment-shares, as if no pagination would have been applied.

Code example

import { environmentSharesClient } from "@dynatrace-sdk/client-document";

const data = await environmentSharesClient.listEnvironmentShares();

trashClient

import { trashClient } from "@dynatrace-sdk/client-document";

deleteTrashedDocument

trashClient.deleteTrashedDocument(config): Promise<void>

Irreversibly destroy the document.

Required scope: document:trash.documents:delete

This operation irreversibly destroys the document. Only the document owner is permitted to do this.

Parameters

NameType
config.id*requiredstring

Code example

import { trashClient } from "@dynatrace-sdk/client-document";

const data = await trashClient.deleteTrashedDocument({
id: "...",
});

inspectTrashedDocument

trashClient.inspectTrashedDocument(config): Promise<TrashDocument>

Inspect the deleted document.

Required scope: document:trash.documents:read

Inspect the deleted document's metadata. Only the document owner is permitted to do this.

Parameters

NameTypeDescription
config.id*requiredstringDocument id.

Returns

Metadata of a deleted document.

Code example

import { trashClient } from "@dynatrace-sdk/client-document";

const data = await trashClient.inspectTrashedDocument({
id: "...",
});

listTrashedDocuments

trashClient.listTrashedDocuments(config): Promise<TrashDocumentList>

List your deleted documents.

Required scope: document:trash.documents:read

Lists all documents, owned by you, which currently reside in the trash.

Note that documents in the trash are irreversibly deleted after 30 days.

Note that at the moment we offer a naïve 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

NameTypeDescription
config.filterstring

The filter parameter, as explained here.

If this parameter is omitted, no filtering is applied and all your deleted documents will be returned.

Filtering by string type parameters when using one of the operators contains, starts-with and ends-with is case insensitive.

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, deletionInfo.deletedTime, deletionInfo.deletedBy

The following constraints apply:

  • The exists operator is not supported.

  • Parameter names are case-sensitive.

  • Maximum nesting depth (via brackets) is 3.

  • Maximum length is 256 characters.

config.pagenumber

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.

config.pageKeystring

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.

config.pageSizenumber

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

A list of documents in the trash.

Code example

import { trashClient } from "@dynatrace-sdk/client-document";

const data = await trashClient.listTrashedDocuments();

restoreTrashedDocument

trashClient.restoreTrashedDocument(config): Promise<void>

Restore the deleted document.

Required scope: document:trash.documents:restore

This operation restores the document from the trash. All users who had access before the deletion regain their access to the document. Only the document owner is permitted to do this.

Parameters

NameType
config.id*requiredstring

Code example

import { trashClient } from "@dynatrace-sdk/client-document";

const data = await trashClient.restoreTrashedDocument({
id: "...",
});

Types

AcquireLock

Input to acquire the lock.

NameTypeDescription
documentVersion*requirednumberThe latest version of the document.
lockDurationInSecondsnumberDuration specified in seconds to acquire the lock on the document.

AcquireLockResult

NameTypeDescription
documentVersion*requirednumberThe latest version of the document.
lockedUntil*requiredDateTimestamp until the document remains locked.

AddDirectShareRecipients

Input required to add recipients to a direct-share.

NameTypeDescription
recipients*requiredArray<SsoEntity>

An array of SSO entities (users and/or groups) to add to this share. They immediately get access to the document.

Already added entities are ignored.

CreateDirectShare

Input required to create a direct-share.

NameTypeDescription
access*requiredstringSpecifies which permissions shall be granted via the share: - read - grants permission to read the document, but not to update or delete it. - read-write - grants permission to read and update the document, but not to delete it.
documentId*requiredstringDocument id.
recipients*requiredArray<SsoEntity>An array of sso-users (sso-ids). These users will immediately get access to the document. Can be empty.

CreateDocumentBody

NameTypeDescription
content*requiredBlob | Buffer | Binary | FileThe binary content of this document. Its exact type is taken from the Content-Type header, which is thus mandatory.
name*requiredstringThe name of this document. This name doesn't need to be unique and is not used as identifier. Maximum length is 128 characters.
type*requiredstringThe type of this document. This type is not the Content-Type of the document, but instead adds a user-defined semantic. Maximum length is 128 characters.

CreateEnvShare

Input required to create a environment-share.

NameTypeDescription
access*requiredstring

Specifies which permissions shall be granted via the share:

  • read - grants permission to read the document, but not to update or delete it. - read-write` - grants permission to read and update the document, but not to delete it.
documentId*requiredstringDocument id.

DeletionInfo

Info related to the deletion of the entity.

NameTypeDescription
deletedBy*requiredstringUser who deleted this document.
deletedTime*requiredDateTime of deletion (in notation as defined by RFC 3339, section 5.6).

DirectShare

NameTypeDescription
access*requiredArray<string>The access granted by this share.
documentId*requiredstringThe shared document's id.
groupCount*requirednumberNumber of groups which have been assigned to this share.
id*requiredstringSystem-generated unique id.
userCount*requirednumberNumber of users who have been directly assigned to this share and therefore can access the document and collaborate on it. Not that potentially assigned groups and their users (see groupCount) are not reflected in this number.

DirectShareList

A list of direct-shares.

NameType
direct-shares*requiredArray<DirectShare>
nextPageKeystring
totalCount*requirednumber

DirectShareRecipientList

Envelope object for a list of recipients.

NameTypeDescription
nextPageKeystringUse this as page-key query param to get the next page
recipientsArray<SsoEntity>
totalCount*requirednumberTotal number of recipients of the share.

DocumentList

Envelope object for a list of metadata

NameTypeDescription
documents*requiredArray<DocumentMetaData>
nextPageKeystringUse this as page-key query param to get the next page. If the list was paginated, and there are more results available, this parameter will be returned.
totalCount*requirednumberThe total amount of matching results for this query, as if no pagination would have been applied.

DocumentLockDetails

The locking details of the document.

NameTypeDescription
documentVersion*requirednumberLatest version of the document.
isLockedbooleanDocument is locked or not.
isLockedByAnotherUser*requiredbooleanDocument is locked by another user or not.
lockedBystringThe user that currently owns the lock.

DocumentMetaData

NameTypeDescription
access*requiredArray<string>

Indicates which operations you may apply to this document. For example, if you own the document, this array contains the values ['read', 'write', 'delete'].

  • read - you may read, but not update or delete it.
  • write - you may update, but not read or delete it.
  • delete - you may delete, but not read or update it.
id*requiredstringSystem-generated unique id.
modificationInfo*requiredModificationInfo
name*requiredstringName, provided by the user. The system is entirely agnostic of this value and there are no semantics attached to it.
owner*requiredstringUnique user id derived from Authorization header.
type*requiredstringType, provided by the user. The system is entirely agnostic of this value and there are no semantics attached to it.
version*requiredstringInitial value is 1. Every manipulation (of metadata or content) leads to an increment. This value is used for optimistic locking during modification operations.

EnvironmentShare

NameTypeDescription
access*requiredArray<string>

Indicates which operations you may apply to this document. For example, if you own the document, this array contains the values ['read', 'write', 'delete'].

  • read - you may read, but not update or delete it.
  • write - you may update, but not read or delete it.
  • delete - you may delete, but not read or update it.
claimCount*requirednumberNumber of users who have claimed this share and therefore can access the document and collaborate on it.
documentId*requiredstringThe shared document's id.
id*requiredstringSystem-generated unique id of a share resource.

EnvironmentShareClaimResult

Confirmation of claiming an environment-share.

NameTypeDescription
access*requiredArray<string>

Indicates which operations you may apply to this document. For example, if you own the document, this array contains the values ['read', 'write', 'delete'].

  • read - you may read, but not update or delete it.
  • write - you may update, but not read or delete it.
  • delete - you may delete, but not read or update it.
documentId*requiredstringThe shared document's id.
documentType*requiredstringThe shared document's type.

EnvironmentShareClaimerList

Envelope object for a list of claimers.

NameTypeDescription
claimers*requiredArray<string>
nextPageKeystringUse this as page-key query param to get the next page
totalCount*requirednumberThe total amount of results for this query

EnvironmentShareList

A list of environment-shares.

NameTypeDescription
environment-shares*requiredArray<EnvironmentShare>
nextPageKeystringUse this as page-key query param to get the next page. If the list was paginated, and there are more results available, this parameter will be returned.
totalCount*requirednumberThe total amount of matching results for this query, as if no pagination would have been applied.

Error

An error response as defined here.

NameType
code*requirednumber
detailsErrorDetails
message*requiredstring

ErrorDetails

NameType
errorRefstring

ErrorEnvelope

NameType
error*requiredError

GetDocumentResponse

NameTypeDescription
contentBinaryThe binary content of this document.
metadataDocumentMetaData

ModificationInfo

info related to creation and modification of the document

NameTypeDescription
createdBy*requiredstringUser which created this document.
createdTime*requiredDateCreation time (in notation as defined by RFC 3339, section 5.6).
lastModifiedBy*requiredstringUser who last modified this document (metadata or content).
lastModifiedTime*requiredDateTime of last modification (in notation as defined by RFC 3339, section 5.6).

RemoveDirectShareRecipients

Input required to remove recipients from a direct-share.

NameType
ids*requiredArray<string>

SsoEntity

A SSO user or SSO group.

NameTypeDescription
id*requiredstringSSO id of a user or group.
type*requiredstringType of the SSO entity - either user or group.

TrashDocument

A document which has been moved to the trash.

NameTypeDescription
deletionInfo*requiredDeletionInfo
id*requiredstringId of the deleted document.
modificationInfo*requiredModificationInfo
name*requiredstringName of the deleted document.
owner*requiredstringOwner of the deleted document.
type*requiredstringType of the deleted document.
version*requirednumberVersion of the deleted document.

TrashDocumentList

Envelope object for a list of documents in trash.

NameTypeDescription
documents*requiredArray<TrashDocumentListEntry>
nextPageKeystringUse this as page-key query param to get the next page. If the list was paginated, and there are more results available, this parameter will be returned.
totalCount*requirednumberThe total amount of matching results for this query, as if no pagination would have been applied.

TrashDocumentListEntry

A document which has been deleted and now lives in the trash.

NameTypeDescription
deletionInfo*requiredDeletionInfo
id*requiredstringId of the deleted document.
name*requiredstringName of the deleted document.
type*requiredstringType of the deleted document.

UpdateDocumentBody

NameTypeDescription
contentBlob | Buffer | Binary | FileThe binary content of this document. Its exact type is taken from the Content-Type header, which is thus mandatory.
namestring

The name of this document. This name doesn't need to be unique and is not used as identifier.

Maximum length is 128 characters.

typestring

The type of this document. This type is not the Content-Type of the document, but instead adds a user-defined semantic.

Maximum length is 128 characters.

UpdateDocumentContentBody

NameType
content*requiredBlob | Buffer | Binary | File

UpdateDocumentMetadata

NameType
documentMetadata*requiredDocumentMetaData

UpdateDocumentMetadataBody

NameTypeDescription
namestringDocument name.
typestringDocument type.
Still have questions?
Find answers in the Dynatrace Community