Attachment Assets (Non-Media File Attachments) - Content Management
Attachment Assets (Non-Media File Attachments)
The attachment_attachmentAsset service attaches supplementary files to media entries (shown as "Related Files" in KMC).
| Action | Description |
|---|---|
attachment_attachmentAsset.add | Create an attachment asset on an entry |
attachment_attachmentAsset.setContent | Upload content to the attachment |
attachment_attachmentAsset.update | Update attachment metadata |
attachment_attachmentAsset.get | Get attachment by ID |
attachment_attachmentAsset.list | List attachments for an entry |
attachment_attachmentAsset.delete | Delete an attachment |
attachment_attachmentAsset.getUrl | Get download URL |
attachment_attachmentAsset.serve | Serve attachment file directly |
# Step 1: Create the attachment asset
curl -X POST "$KALTURA_SERVICE_URL/service/attachment_attachmentAsset/action/add" \
-d "ks=$KALTURA_KS" \
-d "format=1" \
-d "entryId=$KALTURA_ENTRY_ID" \
-d "attachmentAsset[objectType]=KalturaAttachmentAsset" \
-d "attachmentAsset[title]=Slide Deck" \
-d "attachmentAsset[format]=3" \
-d "attachmentAsset[fileExt]=pdf"
# Step 2: Upload the file using an upload token
curl -X POST "$KALTURA_SERVICE_URL/service/attachment_attachmentAsset/action/setContent" \
-d "ks=$KALTURA_KS" \
-d "format=1" \
-d "id=$ATTACHMENT_ASSET_ID" \
-d "contentResource[objectType]=KalturaUploadedFileTokenResource" \
-d "contentResource[token]=$UPLOAD_TOKEN_ID"
# List attachments for an entry
curl -X POST "$KALTURA_SERVICE_URL/service/attachment_attachmentAsset/action/list" \
-d "ks=$KALTURA_KS" \
-d "format=1" \
-d "filter[entryIdEqual]=$KALTURA_ENTRY_ID"
# Get direct download URL
curl -X POST "$KALTURA_SERVICE_URL/service/attachment_attachmentAsset/action/getUrl" \
-d "ks=$KALTURA_KS" \
-d "format=1" \
-d "id=$ATTACHMENT_ASSET_ID"
Attachment format types:
| Value | Name | Description |
|---|---|---|
| 1 | TEXT | Plain text files |
| 2 | MEDIA | Media files not for transcoding (supplementary media) |
| 3 | DOCUMENT | Documents (PDF, DOCX, PPTX, etc.) |
| 4 | JSON | Structured JSON data |
Business scenario -- supplementary materials: An e-learning platform attaches PDF handouts, exercise files, and code samples to each video lecture. Learners download these via attachmentAsset.serve or attachmentAsset.getUrl.