Create new gallery entry

POST /V1/products/{sku}/media

Create new gallery entry

Path parameters

Body

  • entry object Required
    Hide entry attributes Show entry attributes object
    • id integer

      Gallery entry ID

    • media_type string Required

      Media type

    • label string Required

      Gallery entry alternative text

    • position integer Required

      Gallery entry position (sort order)

    • disabled boolean Required

      If gallery entry is hidden from product page

    • types array[string] Required

      Gallery entry image types (thumbnail, image, small_image etc)

    • file string

      File path

    • content object

      Image Content data interface

      Hide content attributes Show content attributes object
    • ExtensionInterface class for @see \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface

      Hide extension_attributes attribute Show extension_attributes attribute object

Responses

  • 200 Success.

    gallery entry ID

  • 401 Unauthorized

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object
    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object
    • trace string

      Stack trace

  • 400 Bad Request

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object
    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object
    • trace string

      Stack trace

  • Unexpected error

    Hide response attributes Show response attributes object
    • message string Required

      Error message

    • errors array[object]

      Error details

      Hide errors attributes Show errors attributes object
    • code integer

      Error code

    • parameters array[object]

      Error parameters item

      Hide parameters attributes Show parameters attributes object
    • trace string

      Stack trace

POST /V1/products/{sku}/media
curl \
 -X POST https://magento2.winkelstraat.mac/rest/all/V1/products/{sku}/media \
 -d '{"entry":{"id":42,"media_type":"string","label":"string","position":42,"disabled":true,"types":["string"],"file":"string","content":{"base64_encoded_data":"string","type":"string","name":"string"},"extension_attributes":{"video_content":{"media_type":"string","video_provider":"string","video_url":"string","video_title":"string","video_description":"string","video_metadata":"string"}}}}'
Request examples
{
  "entry": {
    "id": 42,
    "media_type": "string",
    "label": "string",
    "position": 42,
    "disabled": true,
    "types": [
      "string"
    ],
    "file": "string",
    "content": {
      "base64_encoded_data": "string",
      "type": "string",
      "name": "string"
    },
    "extension_attributes": {
      "video_content": {
        "media_type": "string",
        "video_provider": "string",
        "video_url": "string",
        "video_title": "string",
        "video_description": "string",
        "video_metadata": "string"
      }
    }
  }
}
Response examples (200)
42
Response examples (401)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (400)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}
Response examples (default)
{
  "message": "string",
  "errors": [
    {
      "message": "string",
      "parameters": [
        {
          "resources": "string",
          "fieldName": "string",
          "fieldValue": "string"
        }
      ]
    }
  ],
  "code": 42,
  "parameters": [
    {
      "resources": "string",
      "fieldName": "string",
      "fieldValue": "string"
    }
  ],
  "trace": "string"
}