MCP Control
Каталог · Изменение

Каталог · Товары · Загрузка · Медиа

catalog_products_upload_media
Синяя керамическая кружка

Попробуйте три запроса

Подготовить
  1. Вы указываетеТовар
  2. ПомощникПодготовка
  3. Вы получаетеПредпросмотр
Запрос в чат
Подготовь «Каталог / Товары / Загрузка / Медиа». Для изменения нужны тип операции, товар. Покажи объект и ожидаемый эффект до выполнения.
Что входит в подготовку
operation
Тип операции
productId
Товар
mimeType
Параметр
Применить
  1. Вы указываетеСогласованные значения
  2. ПомощникОдин вызов
  3. Вы получаетеОтвет операции
Запрос в чат
На учебной записи подготовь «Каталог / Товары / Загрузка / Медиа» с параметром operation = prepare. Покажи остальные обязательные значения и выполни действие, когда согласованы все поля.
Фрагмент учебных параметров
operation
prepare
mimeType
image/jpeg
language
ru
Проверить итог
  1. Вы указываетеИсходный ответ
  2. ПомощникСверка результата
  3. Вы получаетеПодтверждение
Запрос в чат
Проверь результат «Каталог / Товары / Загрузка / Медиа» по исходному ответу. Покажи товар, uploadId. Объясни, чем подтвердить эффект для выбранного объекта.
Как сверить изменение
  1. До измененияПрочитать версию
  2. При записиПередать выбранную версию
  3. После ответаПеречитать объект
Как работает действие

Этот вызов может изменить рабочие данные. Согласуйте точный объект, новые значения и ожидаемый результат. Присвойте операции стабильный requestId. При повторе той же операции используйте прежний ключ и те же значения. Прочитайте актуальную версию записи перед подготовкой запроса.

Описание разработчика

Загрузить фото или видео товара в публичную карточку. Upload and attach a product photo or video in Control. Prepare provides direct multipart PUT URLs; use status with partNumbers for more parts and complete to attach using the current native product revision to the native gallery. One action supports photos/videos, including an existing managed mediaId/fileId. Retain uploadId and stable request IDs for retries.

Параметры запроса
operation
Выберите вариант операции из контракта. обязательно по схеме · string · варианты prepare, status, complete
productId
Идентификатор найденного товара. обязательно по схеме · string · до символов 128
mimeType
Required when starting. JPEG, PNG, WebP, MP4 or WebM. необязательно · string · варианты image/jpeg, image/png, image/webp, video/mp4, video/webm
byteLength
Exact original byte length for a new upload. Uses multipart object storage within provider limits. необязательно · integer · максимум 9007199254740991
uploadId
Managed product upload ID from prepare. Keep for status, later parts and complete. необязательно · string
fileId
For an already completed private MP4 or WebM file from files_list, use complete with fileId. необязательно · string
mediaId
For an already completed managed image from media_get_upload_status, use complete with mediaId. необязательно · string
partNumbers
Up to 32 part numbers to sign for raw PUT. Request more pages for large files. необязательно · array · до элементов 32
afterPart
Continue listing completed provider parts after this number. необязательно · integer · минимум 0 · максимум 10000
revision
Текущая версия выбранной записи. необязательно · string
language
Язык результата или локализуемого значения согласно схеме. необязательно · string · варианты ru, en, es, uk, he
color
Optional exact catalog color label for a video. необязательно · string · до символов 120
requestId
Ключ этой операции. Для повтора с теми же аргументами сохраните исходное значение. обязательно по схеме · string · до символов 128
Что вернёт команда
productId
Authorized product. обязательно по схеме · string
uploadId
Direct media upload ID. необязательно · string
status
attached means the native product gallery has been read back. обязательно по схеме · string · варианты uploading, uploaded, attached
method
Send original bytes directly to signed part URLs. необязательно · string
partSize
Size of each nonfinal part in bytes. необязательно · integer · минимум -9007199254740991 · максимум 9007199254740991
totalParts
Total parts for the source file. необязательно · integer · минимум -9007199254740991 · максимум 9007199254740991
parts
Signed PUT instructions for requested parts. необязательно · array
expiresAt
Signed URL expiration. необязательно · string
uploadedParts
Already received parts in this page. необязательно · array
nextAfterPart
Next status cursor; null ends this page sequence. необязательно · integer / null
revision
Current native product revision observed during this call. необязательно · string
url
Stable public image or video URL once attached. необязательно · string
Поля и технические схемы
Входные поля и поля ответа catalog_products_upload_media
Вход · JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "operation": {
      "type": "string",
      "enum": [
        "prepare",
        "status",
        "complete"
      ],
      "description": "prepare starts or resumes binary upload; status reads progress and can issue the next part URLs; complete verifies storage and attaches to the product."
    },
    "productId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Existing authorized native product."
    },
    "mimeType": {
      "description": "Required when starting. JPEG, PNG, WebP, MP4 or WebM.",
      "type": "string",
      "enum": [
        "image/jpeg",
        "image/png",
        "image/webp",
        "video/mp4",
        "video/webm"
      ]
    },
    "byteLength": {
      "description": "Exact original byte length for a new upload. Uses multipart object storage within provider limits.",
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "uploadId": {
      "description": "Managed product upload ID from prepare. Keep for status, later parts and complete.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "fileId": {
      "description": "For an already completed private MP4 or WebM file from files_list, use complete with fileId.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "mediaId": {
      "description": "For an already completed managed image from media_get_upload_status, use complete with mediaId.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "partNumbers": {
      "description": "Up to 32 part numbers to sign for raw PUT. Request more pages for large files.",
      "minItems": 1,
      "maxItems": 32,
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 10000
      }
    },
    "afterPart": {
      "description": "Continue listing completed provider parts after this number.",
      "type": "integer",
      "minimum": 0,
      "maximum": 10000
    },
    "revision": {
      "description": "Optional exact revision for a strict caller-side precondition on complete. If omitted, complete reads and updates the current gallery with a revision precondition.",
      "type": "string",
      "pattern": "^[a-f0-9]{32}$"
    },
    "language": {
      "description": "Optional language for a photo entry. New multipart photos default to all languages.",
      "type": "string",
      "enum": [
        "ru",
        "en",
        "es",
        "uk",
        "he"
      ]
    },
    "color": {
      "description": "Optional exact catalog color label for a video.",
      "type": "string",
      "maxLength": 120
    },
    "requestId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_-]+$",
      "description": "Stable operation-specific retry ID. Use distinct IDs for prepare, status and complete."
    }
  },
  "required": [
    "operation",
    "productId",
    "requestId"
  ],
  "additionalProperties": false
}
Выход · JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "productId": {
      "type": "string",
      "description": "Authorized product."
    },
    "uploadId": {
      "description": "Direct media upload ID.",
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "status": {
      "type": "string",
      "enum": [
        "uploading",
        "uploaded",
        "attached"
      ],
      "description": "attached means the native product gallery has been read back."
    },
    "method": {
      "description": "Send original bytes directly to signed part URLs.",
      "type": "string",
      "const": "PUT"
    },
    "partSize": {
      "description": "Size of each nonfinal part in bytes.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "totalParts": {
      "description": "Total parts for the source file.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "parts": {
      "description": "Signed PUT instructions for requested parts.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "partNumber": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "One-based part number."
          },
          "byteLength": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Exact size for this part."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Time-limited PUT URL for the source bytes of this part."
          }
        },
        "required": [
          "partNumber",
          "byteLength",
          "url"
        ],
        "additionalProperties": false
      }
    },
    "expiresAt": {
      "description": "Signed URL expiration.",
      "type": "string"
    },
    "uploadedParts": {
      "description": "Already received parts in this page.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "partNumber": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "One-based part number."
          },
          "byteLength": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Exact size for this part."
          }
        },
        "required": [
          "partNumber",
          "byteLength"
        ],
        "additionalProperties": false
      }
    },
    "nextAfterPart": {
      "description": "Next status cursor; null ends this page sequence.",
      "anyOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "revision": {
      "description": "Current native product revision observed during this call.",
      "type": "string"
    },
    "url": {
      "description": "Stable public image or video URL once attached.",
      "type": "string",
      "format": "uri"
    }
  },
  "required": [
    "productId",
    "status"
  ],
  "additionalProperties": false
}