[Flex] Download Asset from Segment
Downloads a specific asset file from a segment in a Flex document. Returns the binary content of the asset with appropriate content-type headers for direct display or download.
URL
(GET) /api/apps/wbflex/documents/{id}/assets/{segmentid}
PARAMETERS
Parameter | Type | Required | Description |
---|---|---|---|
id (URL) | string | Mandatory | The unique Flex document identifier |
segmentid (URL) | int | Mandatory | The unique segment identifier containing the asset |
filename (Query) | string | Mandatory | The name of the asset file to download |
locale (Query) | string | Optional | Language code if the asset is associated with a specific language |
relativePath (Query) | string | Optional | Relative path within the segment's asset folder. If provided, takes precedence over path in filename |
ACCESS RIGHTS
The user must have access rights to the Flex document. The system checks document-level permissions to ensure the user can download assets from the specified document.
EXAMPLE REQUEST
curl --location '{{URL}}/api/apps/wbflex/documents/19914/assets/27667833?locale=en&filename=pexels-gons2.jpg&relativePath=public/images' \
--header 'X-Auth-Token: {{AUTH_TOKEN}}' \
--header 'X-Auth-AccountId: {{ACCOUNT_ID}}'
RESULTS
The response returns the binary content of the requested asset file with appropriate HTTP headers:
Header | Description |
---|---|
Content-Type | The MIME type of the asset (e.g., image/jpeg, image/png, video/mp4) |
Content-Length | The size of the file in bytes |
Content-Disposition | Specifies how the browser should handle the file (inline for display, attachment for download) |
Cache-Control | Max age set to 2592000 seconds (30 days) for optimal caching |
Response Body: Binary content of the asset file
EXAMPLE RESPONSE
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: 2268156
Content-Disposition: inline; filename="pexels-gons2.jpg"
Cache-Control: max-age=2592000
[Binary image data]
USAGE NOTES
The endpoint returns the raw binary content of the asset
The Content-Type header indicates the file type (image/jpeg, image/png, video/mp4, etc.)
Response includes caching headers for optimal performance (30-day cache)
If locale is specified, the system looks for the asset in the language-specific subfolder
The filename parameter must match exactly the stored filename
File Path Handling: The system supports two ways to specify file paths:
Use the relativePath parameter to specify the folder structure
Include the path directly in the filename (e.g., "subfolder/image.jpg")
If both are provided, relativePath takes precedence