Skip to content

Media Resources Endpoints

Media Resources API endpoints.


Overview

Method Endpoint Description
PATCH /api/v1/media-resources/{media_resource_id} Patch Media Resource Metadata

API Reference

Sartiq Backend Server - Media Resources 0.1.0

media-resources


PATCH /api/v1/media-resources/{media_resource_id}

Patch Media Resource Metadata

Description

Fill unset metadata fields on a media resource.

Only fields that are currently NULL on the resource will be updated. Fields that already have a value are silently skipped — no error is raised so that callers can fire-and-forget enrichment payloads.

Input parameters

Parameter In Type Default Nullable Description
OAuth2PasswordBearer header string N/A No
media_resource_id path string No

Request body

{
    "color_profile": null,
    "duration": null,
    "dominant_color": null,
    "width": null,
    "height": null,
    "alt_text": null,
    "caption": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "color_profile": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Color Profile"
        },
        "duration": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Duration"
        },
        "dominant_color": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Dominant Color"
        },
        "width": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Width"
        },
        "height": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Height"
        },
        "alt_text": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Alt Text"
        },
        "caption": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Caption"
        }
    },
    "type": "object",
    "title": "MediaResourceMetadataUpdate",
    "description": "Patch schema that only allows setting fields that are currently NULL.\n\nUsed by the PATCH /media-resources/{id} endpoint so that background\nworkers (image analysis, captioning, etc.) can enrich metadata without\noverwriting values that were already established."
}

Responses

{
    "id": "cc10899b-7266-40d3-9e2f-6686c6c88b67",
    "resource_type": "IMAGE",
    "url": "string",
    "content_hash": "string",
    "extension": "string",
    "file_size": 0,
    "width": null,
    "height": null,
    "dominant_color": null,
    "protected": true,
    "alt_text": null,
    "caption": null,
    "color_profile": null,
    "duration": null,
    "aspect_ratio": null,
    "orientation": null,
    "created_at": "2022-04-13T15:42:05.901Z"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
        },
        "resource_type": {
            "$ref": "#/components/schemas/MediaResourceType"
        },
        "url": {
            "type": "string",
            "title": "Url"
        },
        "content_hash": {
            "type": "string",
            "title": "Content Hash"
        },
        "extension": {
            "type": "string",
            "title": "Extension"
        },
        "file_size": {
            "type": "integer",
            "title": "File Size"
        },
        "width": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Width"
        },
        "height": {
            "anyOf": [
                {
                    "type": "integer"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Height"
        },
        "dominant_color": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Dominant Color"
        },
        "protected": {
            "type": "boolean",
            "title": "Protected",
            "default": false
        },
        "alt_text": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Alt Text"
        },
        "caption": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Caption"
        },
        "color_profile": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Color Profile"
        },
        "duration": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Duration"
        },
        "aspect_ratio": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Aspect Ratio"
        },
        "orientation": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Orientation"
        },
        "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
        }
    },
    "type": "object",
    "required": [
        "id",
        "resource_type",
        "url",
        "content_hash",
        "extension",
        "file_size",
        "created_at"
    ],
    "title": "MediaResourcePublic",
    "description": "Public output schema for media resources.\n\nThe `url` field contains the full CDN URL resolved from the\ninternal `storage_key`."
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string",
            "input": null,
            "ctx": {}
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

HTTPValidationError

Name Type Description
detail Array<ValidationError>

MediaResourceMetadataUpdate

Name Type Description
alt_text
caption
color_profile
dominant_color
duration
height
width

MediaResourcePublic

Name Type Description
alt_text
aspect_ratio
caption
color_profile
content_hash string
created_at string(date-time)
dominant_color
duration
extension string
file_size integer
height
id string(uuid)
orientation
protected boolean
resource_type MediaResourceType
url string
width

MediaResourceType

Type: string

ValidationError

Name Type Description
ctx
input
loc Array<>
msg string
type string

Security schemes

Name Type Scheme Description
OAuth2PasswordBearer oauth2