Saltar al contenido principal

Create Preset

This endpoint allows you to create a new preset configuration in the system. The preset can include various settings, multimedia assets, and can be associated with products.

🔹 Endpoint Details

POST /api/v1/presets

🔒 Authentication

HeaderRequiredDescription
Content-TypeYesMust be application/json
AuthorizationYesFormat: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature

📝 Request Body

FieldTypeRequiredDescription
titlestringYesThe title of the preset
descriptionstringNoA detailed description of the preset
logostringNoURL or path to the preset logo
imagestringNoURL or path to the preset cover image
assetIdsarray of stringsNoArray of existing multimedia asset IDs to associate with this preset
assetsarray of objectsNoArray of new multimedia assets to create along with this preset
productsarray of stringsNoArray of product identifiers to associate with this preset
effectIdstringNoID of the effect to be applied to this preset

📤 Request Example

curl -X POST "https://openapi.onlive.site/api/v1/presets" \
-H "Content-Type: application/json" \
-H "Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature" \
-d '{
"title": "My Custom Preset",
"description": "This preset contains settings for video streaming",
"logo": "https://example.com/logo.png",
"image": "https://example.com/cover.png",
"assetIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"assets": [
{
"name": "string",
"app": {
"source": {
"url": "string",
"security": "string"
},
"resource": "string",
"args": "string"
},
"url": "string",
"format": "string",
"description": "string",
"size": 0,
"duration": 0,
"status": "string",
"environment": {},
"coverVideo": {
"id": "string",
"url": "string",
"size": 0,
"format": "string",
"duration": 0
},
"options": {
"usePixelStreaming": true,
"timeout": 0,
"showBooking": true,
"showRegister": true
}
}
],
"products": [
"product1",
"product2"
],
"effectId": "effect123"
}'

📥 Response

Success Response (201 Created)

FieldTypeDescription
idstringUnique identifier for the newly created preset
organizationIdstringOrganization ID that owns this preset
titlestringThe title of the preset
descriptionstringA detailed description of the preset
logostringURL to the preset logo
imagestringURL to the preset cover image
assetsarray of stringsIDs of multimedia assets associated with this preset
productsarray of stringsProduct identifiers associated with this preset
effectIdstringID of the effect applied to this preset
createdAtstring (ISO 8601)Creation timestamp
updatedAtstring (ISO 8601)Last update timestamp

Response Example

{
"id": "123e4567-e89b-12d3-a456-426614174001",
"organizationId": "123e4567-e89b-12d3-a456-426614174002",
"title": "My Custom Preset",
"description": "This preset contains settings for video streaming",
"logo": "https://example.com/logo.png",
"image": "https://example.com/cover.png",
"assets": [
"123e4567-e89b-12d3-a456-426614174003",
"123e4567-e89b-12d3-a456-426614174004"
],
"products": ["product1", "product2"],
"effectId": "effect123",
"createdAt": "2025-05-28T10:15:30Z",
"updatedAt": "2025-05-28T10:15:30Z"
}

❌ Error Responses

400 Bad Request

{
"statusCode": 400,
"message": "Invalid input",
"errors": [
{
"field": "title",
"message": "title must not be empty"
}
]
}

401 Unauthorized

{
"statusCode": 401,
"message": "Unauthorized access",
"error": "Unauthorized"
}

403 Forbidden

{
"statusCode": 403,
"message": "Insufficient permissions to create presets"
}

409 Conflict

{
"statusCode": 409,
"message": "A preset with the title 'My Custom Preset' already exists",
"error": "Conflict"
}

🔍 Validation Rules

  1. Title Validation

    • Title must not be empty
    • Title must be unique within your organization
    • Maximum length is 255 characters
  2. Asset Validation

    • Asset references must be valid UUIDs
    • Assets must be accessible by your organization
    • New assets must comply with multimedia format requirements
  3. Product Validation

    • Product references must be valid
    • Products must be accessible by your organization
    • Maximum 50 products per preset
  4. Effect Validation

    • Effect ID must reference a valid effect
    • Effect must be compatible with the associated assets

💡 Best Practices

  1. Resource Management

    • Use descriptive titles for easier identification
    • Group related assets within a single preset
    • Add detailed descriptions for better organization
  2. Asset Handling

    • Reference existing assets when possible instead of creating duplicates
    • Optimize multimedia assets before association
    • Consider asset compatibility with target platforms
  3. Organization

    • Use consistent naming conventions
    • Associate presets with appropriate products
    • Document preset purpose and usage scenarios

📘 Notes

  • The organizationId is automatically set from your authentication credentials
  • Asset references can be provided either via assetIds or by creating new assets inline
  • All multimedia assets created with a preset will be automatically associated with it
  • You must have the appropriate permissions to create presets in your organization
  • The unique constraint for preset titles is scoped to your organization

✅ Common Use Cases

  • 🎨 Media Configuration: Setting up preset configurations for multimedia assets
  • 🔄 Product Association: Linking presets with specific products
  • 🎬 Effect Application: Adding visual effects to multimedia content
  • 🧩 Template Creation: Creating reusable templates for content creation
  • 📊 Resource Organization: Organizing related multimedia assets