Bassam
Bassam

Reputation: 1

Akeneo PIM - add media to product validation

we are trying to add media to a product from a REST call, and facing an error.

{
    "code": 422,
    "message": "Validation failed.",
    "errors": [
        {
            "property": "attribute",
            "message": "Cannot set the property \"banner_image\" to this entity as it is not in the attribute set"
        }
    ]
}
API ENDPOINT: {{url}}/api/rest/v1/media-files
form-data:
product -> {"identifier":"1273192971", "attribute":"banner_image", "scope": null,"locale":null, "data":null}
file -> testfile.jpg

If anyone can help, how to properly enter the attribute in JSON?

Regards, Bassam

we are facing error:

Upvotes: 0

Views: 121

Answers (1)

neisantos
neisantos

Reputation: 491

as you can see you need your attribute banner_image to be added to your family before you try submit the request.

Go to Settings -> Families -> Select all from checkbox and hit bulk actions. Select set attributes requirements then click on add attribute to add your banner_image attribute and save.

After that your request should work.

Upvotes: 0

Related Questions