- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
InitiateDocumentVersionUploadCommand
Creates a new document object and version object.
The client specifies the parent folder ID and name of the document to upload. The ID is optionally specified when creating a new version of an existing document. This is the first step to upload a document. Next, upload the document to the URL returned from the call, and then call UpdateDocumentVersion.
To cancel the document upload, call AbortDocumentVersionUpload.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { WorkDocsClient, InitiateDocumentVersionUploadCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
// const { WorkDocsClient, InitiateDocumentVersionUploadCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
const client = new WorkDocsClient(config);
const input = { // InitiateDocumentVersionUploadRequest
AuthenticationToken: "STRING_VALUE",
Id: "STRING_VALUE",
Name: "STRING_VALUE",
ContentCreatedTimestamp: new Date("TIMESTAMP"),
ContentModifiedTimestamp: new Date("TIMESTAMP"),
ContentType: "STRING_VALUE",
DocumentSizeInBytes: Number("long"),
ParentFolderId: "STRING_VALUE",
};
const command = new InitiateDocumentVersionUploadCommand(input);
const response = await client.send(command);
// { // InitiateDocumentVersionUploadResponse
// 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",
// ],
// },
// UploadMetadata: { // UploadMetadata
// UploadUrl: "STRING_VALUE",
// SignedHeaders: { // SignedHeaderMap
// "<keys>": "STRING_VALUE",
// },
// },
// };
InitiateDocumentVersionUploadCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
AuthenticationToken | string | undefined | Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API. |
ContentCreatedTimestamp | Date | undefined | The timestamp when the content of the document was originally created. |
ContentModifiedTimestamp | Date | undefined | The timestamp when the content of the document was modified. |
ContentType | string | undefined | The content type of the document. |
DocumentSizeInBytes | number | undefined | The size of the document, in bytes. |
Id | string | undefined | The ID of the document. |
Name | string | undefined | The name of the document. |
ParentFolderId | string | undefined | The ID of the parent folder. |
InitiateDocumentVersionUploadCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Metadata | DocumentMetadata | undefined | The document metadata. |
UploadMetadata | UploadMetadata | undefined | The upload metadata. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
DraftUploadOutOfSyncException | client | This exception is thrown when a valid checkout ID is not presented on document version upload calls for a document that has been checked out from Web client. |
EntityAlreadyExistsException | client | The resource already exists. |
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. |
LimitExceededException | client | The maximum of 100,000 files and folders under the parent folder has been exceeded. |
ProhibitedStateException | client | The specified document version is not in the INITIALIZED state. |
ResourceAlreadyCheckedOutException | client | The resource is already checked out. |
ServiceUnavailableException | server | One or more of the dependencies is unavailable. |
StorageLimitExceededException | client | The storage limit has been exceeded. |
StorageLimitWillExceedException | client | The storage limit will be exceeded. |
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. |