Use case: Read the download url for a file attachment of an annotation
Before you start
Before you retrieve a download URL for a file attachment, ensure you have completed the following prerequisites:
- Verify Permissions: Confirm that you have the necessary rights to access the attachment. This typically requires having read access to the annotation containing the attachment.
- Identify the Attachment: Have the unique identifier of the specific attachment you need to download. You'll need this to request the correct download URL.
- Understand URL Expiration: Be aware that download URLs provided by the Collaboration system are typically temporary and expire after a certain period (usually 24 hours or less). They should be used promptly rather than stored long-term.
- Storage Considerations: Ensure you have sufficient local storage if you plan to download large files, especially when implementing batch download functionality.
- Set Up SDK Environment: Ensure your Unity environment is properly configured with the Collaboration SDK to interact with the annotation system.
How do I...?
Get a download URL for a specific attachment
To retrieve a download URL for an identified attachment:
- Obtain the Project Identifier: Ensure you have the correct project identifier (GUID) for the project.
- Obtain the Asset Identifier: Ensure you have the correct and complete asset identifier (GUID) for the asset.
- Obtain the Attachment ID: Ensure you have the unique identifier for the specific attachment you want to get the download url for.
- Request the Download URL: Use the SDK to request a temporary download URL for the attachment.
- Use the URL Promptly: Remember that the download URL has a limited validity period.
Example:
var response = await annotationManagement.ReadAnnotationFileAttachmentDownloadUrlAsync(
projectId: projectId,
annotationId: annotationId,
attachmentId: attachmentId,
cancellationToken: cancellationToken);
var downloadUrl = response.Url;
For more information on working with attachments, see the documentation on creating attachments and updating attachments.