cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 - API Product Creation

Highlighted

Magento 2 - API Product Creation

I am trying to add a product with a product image using the API however I am getting the error message.

"magento Property "Type" does not have corresponding setter in class \"Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface\"

Code being sent -

{
"product": {
"sku": "ZZZ simple 1 57e30a6073000",
"name": "Simple Product Test57e30a60730aa",
"visibility": 4,
"type_id": "simple",
"price": 99.95,
"status": 1,
"attribute_set_id": 4,
"weight": 1,
"custom_attributes": [
{
"attribute_code": "category_ids",
"value": [
"42",
"41",
"32"
]
},
{
"attribute_code": "description",
"value": "Simple Description"
},
{
"attribute_code": "short_description",
"value": "Simple Short Description"
}
],
"mediaGalleryEntries": {
"mediaType": "image",
"label": "Test Image Text",
"position": "0",
"disabled": true,
"types": [
"image",
"thumbnail",
"small_image"
],
"file": "test_image.jpg",
"content": {
"type": "image/jpeg",
"base64EncodedData": "\/9j\/4AAQSkZJRgABAQEAYABgAAD\/2wBDAAg <base 64 data cut>",
"name": "TestImage.jpg"
}
}
}
}

Thanks for your help.