Skip to main content

Files

This page documents the file operation endpoints in the VAMS API. These endpoints manage individual files within assets, including listing, moving, copying, archiving, uploading, and streaming.

For asset-level operations, see Assets. For file metadata, see Metadata.


Concepts

  • File: An individual object stored in S3 within an asset's directory structure. Files can be organized in folders.
  • File Version: S3 object versions tracked through bucket versioning. VAMS also tracks file versions within asset version snapshots.
  • Primary File Type: A designation that marks a file as the primary representative of a particular type within an asset (e.g., the primary .ifc file).
  • Preview File: A generated preview image (.previewFile.gif, .previewFile.jpg, .previewFile.png) associated with a specific file.
  • Archive: Soft-deletion of a file using S3 delete markers. Archived files can be unarchived.

Endpoints

List Files

GET /database/{databaseId}/assets/{assetId}/listFiles

Returns a list of all files in the specified asset, including file metadata, sizes, and archive status.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
maxItemsqueryintegerNoMaximum number of files to return.
pageSizequeryintegerNoPage size for pagination.
startingTokenquerystringNoContinuation token from a previous response.

Response:

{
"files": [
{
"key": "/models/building.ifc",
"size": 15728640,
"lastModified": "2024-06-15T10:30:00Z",
"etag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
"isArchived": false,
"isFolder": false,
"primaryType": "ifc",
"hasPreview": true,
"versionId": "abc123"
},
{
"key": "/textures/",
"size": 0,
"lastModified": "2024-06-15T10:30:00Z",
"isArchived": false,
"isFolder": true
}
],
"NextToken": "eyJ..."
}

Error Responses:

StatusDescription
400Invalid parameters.
403Not authorized to list files in this asset.
404Database or asset not found.
500Internal server error.

Get File Info

GET /database/{databaseId}/assets/{assetId}/fileInfo

Retrieves detailed information about a specific file, including S3 metadata, version history, and archive status.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
keyquerystringYesThe relative file path (e.g., /models/building.ifc).

Response:

{
"key": "/models/building.ifc",
"size": 15728640,
"lastModified": "2024-06-15T10:30:00Z",
"etag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
"contentType": "application/octet-stream",
"isArchived": false,
"versionId": "abc123",
"versions": [
{
"versionId": "abc123",
"lastModified": "2024-06-15T10:30:00Z",
"size": 15728640,
"isLatest": true
}
]
}

Error Responses:

StatusDescription
400Invalid parameters or missing key parameter.
403Not authorized to view this file.
404File not found.
500Internal server error.

Move/Rename File

POST /database/{databaseId}/assets/{assetId}/moveFile

Moves or renames a file within the asset. This copies the file to the new location and deletes the original.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.

Request Body:

{
"sourcePath": "/models/old-name.ifc",
"destinationPath": "/models/new-name.ifc"
}
FieldTypeRequiredDescription
sourcePathstringYesCurrent relative file path.
destinationPathstringYesNew relative file path.

Response:

{
"message": "File moved successfully",
"sourcePath": "/models/old-name.ifc",
"destinationPath": "/models/new-name.ifc"
}

Error Responses:

StatusDescription
400Invalid parameters, source file not found, or destination already exists.
403Not authorized to modify files in this asset.
500Internal server error.

Copy File

POST /database/{databaseId}/assets/{assetId}/copyFile

Copies a file within the same asset or to a different asset. Supports cross-database copying when destinationDatabaseId is provided.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesSource database identifier.
assetIdpathstringYesSource asset identifier.

Request Body:

{
"sourcePath": "/models/building.ifc",
"destinationPath": "/models/building-copy.ifc",
"destinationAssetId": "asset-002",
"destinationDatabaseId": "other-database"
}
FieldTypeRequiredDescription
sourcePathstringYesSource file relative path.
destinationPathstringYesDestination file relative path.
destinationAssetIdstringNoTarget asset ID (defaults to same asset).
destinationDatabaseIdstringNoTarget database ID for cross-database copy.

Response:

{
"message": "File copied successfully",
"sourcePath": "/models/building.ifc",
"destinationPath": "/models/building-copy.ifc"
}

Error Responses:

StatusDescription
400Invalid parameters or source file not found.
403Not authorized to copy files.
500Internal server error.

Delete File

DELETE /database/{databaseId}/assets/{assetId}/deleteFile

Permanently deletes a file from the asset. This removes all versions of the file from S3.

Irreversible Operation

This permanently deletes the file and all its versions. Consider using Archive File for soft-deletion instead.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
keyquerystringYesRelative file path to delete.

Response:

{
"message": "File deleted successfully"
}

Error Responses:

StatusDescription
400Invalid parameters or missing key.
403Not authorized to delete files in this asset.
404File not found.
500Internal server error.

Archive File

DELETE /database/{databaseId}/assets/{assetId}/archiveFile

Soft-deletes a file by creating an S3 delete marker. The file can be restored using Unarchive File.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
keyquerystringYesRelative file path to archive.

Response:

{
"message": "File archived successfully"
}

Error Responses:

StatusDescription
400Invalid parameters.
403Not authorized to archive files in this asset.
404File not found.
500Internal server error.

Unarchive File

POST /database/{databaseId}/assets/{assetId}/unarchiveFile

Restores a previously archived file by removing the S3 delete marker.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.

Request Body:

{
"key": "/models/building.ifc"
}
FieldTypeRequiredDescription
keystringYesRelative file path to unarchive.

Response:

{
"message": "File unarchived successfully"
}

Error Responses:

StatusDescription
400Invalid parameters.
403Not authorized to unarchive files in this asset.
404File not found or not archived.
500Internal server error.

Create Folder

POST /database/{databaseId}/assets/{assetId}/createFolder

Creates a new folder (zero-byte S3 object with trailing slash) within the asset's directory structure.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.

Request Body:

{
"folderPath": "/new-folder/"
}
FieldTypeRequiredDescription
folderPathstringYesThe folder path to create (must end with /).

Response:

{
"message": "Folder created successfully",
"folderPath": "/new-folder/"
}

Error Responses:

StatusDescription
400Invalid parameters or folder already exists.
403Not authorized to create folders in this asset.
500Internal server error.

Revert File Version

POST /database/{databaseId}/assets/{assetId}/revertFileVersion/{versionId}

Reverts a file to a specific previous S3 version by copying the old version as the new current version.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
versionIdpathstringYesThe S3 version ID to revert to.

Request Body:

{
"key": "/models/building.ifc"
}
FieldTypeRequiredDescription
keystringYesRelative file path to revert.

Response:

{
"message": "File version reverted successfully",
"key": "/models/building.ifc",
"newVersionId": "def456"
}

Error Responses:

StatusDescription
400Invalid parameters or version not found.
403Not authorized to revert file versions.
404File or version not found.
500Internal server error.

Set Primary File Type

PUT /database/{databaseId}/assets/{assetId}/setPrimaryFile

Designates a file as the primary representative of its file type within the asset. Only one file per type can be primary.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.

Request Body:

{
"key": "/models/building.ifc",
"primaryType": "ifc"
}
FieldTypeRequiredDescription
keystringYesRelative file path.
primaryTypestringYesThe file type designation.

Response:

{
"message": "Primary file type set successfully",
"key": "/models/building.ifc",
"primaryType": "ifc"
}

Error Responses:

StatusDescription
400Invalid parameters.
403Not authorized to modify file attributes.
404File not found.
500Internal server error.

Upload Endpoints

Upload File

POST /uploads

Initiates a file upload by returning presigned S3 URLs. For small files, a single presigned PUT URL is returned. For large files (multipart upload), the request is queued for asynchronous processing via SQS.

Request Body:

{
"databaseId": "my-database",
"assetId": "asset-001",
"key": "/models/building.ifc",
"contentType": "application/octet-stream",
"fileSize": 15728640,
"numParts": 1
}
FieldTypeRequiredDescription
databaseIdstringYesTarget database identifier.
assetIdstringYesTarget asset identifier.
keystringYesRelative file path for the upload.
contentTypestringNoMIME type of the file.
fileSizeintegerNoFile size in bytes.
numPartsintegerNoNumber of multipart upload parts (for large files, max 10,000).

Response:

{
"uploadId": "upload-12345",
"presignedUrls": ["https://bucket.s3.amazonaws.com/...?X-Amz-..."],
"s3UploadId": "multipart-upload-id"
}

Error Responses:

StatusDescription
400Invalid parameters, blocked file extension, or blocked MIME type.
403Not authorized to upload files to this asset.
500Internal server error.
Blocked File Types

For security, certain file extensions are blocked: .jar, .java, .com, .php, .reg, .pif, .bak, .dll, .exe, .nat, .cmd, .lnk, .docm, .vbs, .bat. Corresponding MIME types are also blocked.


Complete Upload

POST /uploads/{uploadId}/complete

Completes a multipart file upload by signaling that all parts have been uploaded.

Request Parameters:

ParameterLocationTypeRequiredDescription
uploadIdpathstringYesThe upload identifier from the initial upload request.

Request Body:

{
"parts": [
{
"PartNumber": 1,
"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\""
}
]
}

Response:

{
"message": "Upload completed successfully"
}

Error Responses:

StatusDescription
400Invalid upload ID or missing parts.
500Internal server error.

Stream Endpoints

Stream Asset File

GET /database/{databaseId}/assets/{assetId}/download/stream/{proxy+}

Streams a file from an asset through the API Gateway. Supports HTTP range requests for partial content delivery, which enables seeking in video/audio files and progressive loading of large files.

HEAD /database/{databaseId}/assets/{assetId}/download/stream/{proxy+}

Returns file metadata (size, content type) without the file body.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
{proxy+}pathstringYesThe relative file path within the asset.
vquerystringNoS3 version ID for a specific file version.
avidquerystringNoVAMS asset version ID.

Response:

Returns the raw file content with appropriate Content-Type and Content-Length headers. For range requests, returns 206 Partial Content.

Error Responses:

StatusDescription
403Not authorized to stream this file.
404File not found.
500Internal server error.

Stream Auxiliary Preview Asset

GET /database/{databaseId}/assets/{assetId}/auxiliaryPreviewAssets/stream/{proxy+}

Streams auxiliary preview files (e.g., Potree octree data, generated viewer files) from the auxiliary S3 bucket. These files are non-versioned and typically generated by processing pipelines.

HEAD /database/{databaseId}/assets/{assetId}/auxiliaryPreviewAssets/stream/{proxy+}

Returns file metadata without the file body.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.
{proxy+}pathstringYesThe relative file path within the auxiliary bucket.

Response:

Returns the raw file content with appropriate headers.

Error Responses:

StatusDescription
403Not authorized to stream this file.
404File not found.
500Internal server error.

Preview Management

Delete Asset Preview

DELETE /database/{databaseId}/assets/{assetId}/deleteAssetPreview

Deletes the asset-level preview image.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.

Response:

{
"message": "Asset preview deleted successfully"
}

Error Responses:

StatusDescription
403Not authorized.
404Asset or preview not found.
500Internal server error.

Delete Auxiliary Preview Files

DELETE /database/{databaseId}/assets/{assetId}/deleteAuxiliaryPreviewAssetFiles

Deletes auxiliary preview files (e.g., Potree viewer data) from the auxiliary bucket for the specified asset.

Request Parameters:

ParameterLocationTypeRequiredDescription
databaseIdpathstringYesDatabase identifier.
assetIdpathstringYesAsset identifier.

Response:

{
"message": "Auxiliary preview files deleted successfully"
}

Error Responses:

StatusDescription
403Not authorized.
404Asset not found.
500Internal server error.