GetDocumentCommand

Retrieves details of a document.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { WorkDocsClient, GetDocumentCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
// const { WorkDocsClient, GetDocumentCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
const client = new WorkDocsClient(config);
const input = { // GetDocumentRequest
  AuthenticationToken: "STRING_VALUE",
  DocumentId: "STRING_VALUE", // required
  IncludeCustomMetadata: true || false,
};
const command = new GetDocumentCommand(input);
const response = await client.send(command);
// { // GetDocumentResponse
//   Metadata: { // DocumentMetadata
//     Id: "STRING_VALUE",
//     CreatorId: "STRING_VALUE",
//     ParentFolderId: "STRING_VALUE",
//     CreatedTimestamp: new Date("TIMESTAMP"),
//     ModifiedTimestamp: new Date("TIMESTAMP"),
//     LatestVersionMetadata: { // DocumentVersionMetadata
//       Id: "STRING_VALUE",
//       Name: "STRING_VALUE",
//       ContentType: "STRING_VALUE",
//       Size: Number("long"),
//       Signature: "STRING_VALUE",
//       Status: "INITIALIZED" || "ACTIVE",
//       CreatedTimestamp: new Date("TIMESTAMP"),
//       ModifiedTimestamp: new Date("TIMESTAMP"),
//       ContentCreatedTimestamp: new Date("TIMESTAMP"),
//       ContentModifiedTimestamp: new Date("TIMESTAMP"),
//       CreatorId: "STRING_VALUE",
//       Thumbnail: { // DocumentThumbnailUrlMap
//         "<keys>": "STRING_VALUE",
//       },
//       Source: { // DocumentSourceUrlMap
//         "<keys>": "STRING_VALUE",
//       },
//     },
//     ResourceState: "ACTIVE" || "RESTORING" || "RECYCLING" || "RECYCLED",
//     Labels: [ // SharedLabels
//       "STRING_VALUE",
//     ],
//   },
//   CustomMetadata: { // CustomMetadataMap
//     "<keys>": "STRING_VALUE",
//   },
// };

GetDocumentCommand Input

See GetDocumentCommandInput for more details

Parameter
Type
Description
DocumentId
Required
string | undefined

The ID of the document.

AuthenticationToken
string | undefined

Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.

IncludeCustomMetadata
boolean | undefined

Set this to TRUE to include custom metadata in the response.

GetDocumentCommand Output

See GetDocumentCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CustomMetadata
Record<string, string> | undefined

The custom metadata on the document.

Metadata
DocumentMetadata | undefined

The metadata details of the document.

Throws

Name
Fault
Details
EntityNotExistsException
client

The resource does not exist.

FailedDependencyException
client

The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.

InvalidArgumentException
client

The pagination marker or limit fields are not valid.

InvalidPasswordException
client

The password is invalid.

ServiceUnavailableException
server

One or more of the dependencies is unavailable.

UnauthorizedOperationException
client

The operation is not permitted.

UnauthorizedResourceAccessException
client

The caller does not have access to perform the action on the resource.

WorkDocsServiceException
Base exception class for all service exceptions from WorkDocs service.