Asset API Reference
Complete API reference for product asset endpoints in Omnium, including CRUD operations and image uploads.
This page documents the public API endpoints for managing product assets in Omnium.
Base URL: /api/products
Authentication: All endpoints require authentication. Read operations require ProductRead access; write operations require ProductAdmin access.
Endpoints Overview
| Method | Endpoint | Description |
|---|---|---|
| GET | /Assets/GetAssets | Get assets by IDs |
| POST | /Assets/AddAssets/{skuId} | Add assets to a product |
| POST | /Assets/UpdateAssets | Update asset metadata |
| DELETE | /Assets/DeleteAssets | Delete assets from products |
| POST | /AddProductImage | Add image from URL (legacy) |
Get Assets
Retrieve assets by their IDs.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
assetIds | List<string> | Yes | Asset IDs to retrieve (query parameter array) |
Response
Status Codes
| Code | Description |
|---|---|
| 200 | Assets found and returned |
| 404 | No asset IDs provided or assets not found |
Add Assets
Add assets to a product. Existing assets with matching asset IDs are replaced.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
skuId | string | Yes | Product ID, SKU, or variant SKU |
isAddedToVariant | bool | No | If true, add to matching variant instead of parent |
Request Body
Asset Fields
| Field | Type | Description |
|---|---|---|
assetId | string | Unique identifier (auto-generated if not provided) |
externalUrl | string | URL to download and store |
isMainImage | bool | Set as main product image |
name | string | Display name |
description | string | Asset description |
altText | string | Alt text for images |
purpose | string | Asset purpose |
sortOrder | int | Display order |
properties | List<PropertyItem> | Custom key-value metadata |
Status Codes
| Code | Description |
|---|---|
| 200 | Assets added successfully |
| 404 | Product or variant not found |
Example: Add to Variant
Update Assets
Update metadata for existing assets without re-uploading files.
Request Body
Updatable Fields
| Field | Update Behavior |
|---|---|
name | Set to empty string to clear |
description | Set to empty string to clear |
altText | Set to empty string to clear |
purpose | Set to empty string to clear |
sortOrder | Any value updates |
properties | Entire list replaced |
isMainImage | Updates main image designation |
externalUrl | New URL with forceUpload: true triggers re-upload |
Status Codes
| Code | Description |
|---|---|
| 200 | Assets updated successfully |
| 404 | No asset IDs provided or products not found |
Force Re-upload
To re-upload an asset with a new external URL:
Delete Assets
Delete assets from products and storage.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
assetIds | List<string> | Yes | Asset IDs to delete |
Status Codes
| Code | Description |
|---|---|
| 200 | Assets deleted successfully |
| 400 | No asset IDs provided |
| 404 | Products with assets not found |
Deleting assets permanently removes files from storage, including preview images. This action cannot be undone.
Add Product Image (Legacy)
Add an image to a product from a URL. This is a simplified endpoint for adding a single image.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | External image URL |
productId | string | Yes | Target product ID |
Behavior
- Downloads image from external URL
- Uploads to Omnium storage
- Adds to product's assets
- Sets as main image if first asset
Status Codes
| Code | Description |
|---|---|
| 200 | Image added successfully |
| 400 | Could not upload file |
Common Use Cases
Add Product with Assets
Include assets when creating or updating a product:
Replace Main Image
Update an existing asset to become the main image:
Bulk Asset Update
Update multiple assets across products:
Error Handling
All endpoints return standard HTTP status codes. Error responses include a message:
| Status | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Missing or invalid authentication |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Asset or product doesn't exist |
| 500 | Server Error - Internal error, retry later |
Business Customer Assets
Assets can also be attached to business customers. These endpoints follow a similar pattern:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/BusinessCustomer/{id}/Assets/GetAssets | Get customer assets |
| POST | /api/BusinessCustomer/{id}/Assets/AddAsset | Add asset from stream |
| POST | /api/BusinessCustomer/{id}/Assets/AddAssets | Add multiple assets |
| POST | /api/BusinessCustomer/{id}/Assets/UpdateAssets | Update customer assets |
| DELETE | /api/BusinessCustomer/{id}/Assets/DeleteAssets | Delete customer assets |
Add Asset from Binary Stream
Upload a file directly as binary data:
This endpoint accepts raw binary data in the request body, useful for:
- Browser file uploads
- Programmatic file creation
- Integration with external systems
