Skip to content

REST-API - Can't upload to file-field on products identified by UUID #298

@OhLookAUser

Description

@OhLookAUser

When developing a solution using the Akeneo REST-API, I had problems uploading a file to a file-field on a product, that is identified by a UUID.

According to the documentation, the API-endpoint expects a property "identifier" (when uploading to a "product") or "code" (when uploading to a "product_model").
Unfortunately, the product (type "product") I was trying to adress, doesn't have an attribute "identifier"; only a "uuid".
So when sending the UUID as identifier, Akeneo can't match it with any products and replies with an error-code (I believe it was 422).
"product": {"identifier":"{uuid}","attribute":"{myField}","locale":"{myLocale}","scope":null}
Sending the payload with a property "uuid" is not supported.
"product": {"uuid":"{uuid}","attribute":"{myField}","locale":"{myLocale}","scope":null}

Could this be caused by the logic of the endpoint (it seems to search a product by looking at the "identifier"-attribute, even if the product doesn't have that; but instead has the "uuid"-attribute)?
And might it be related to the way product identifiers are setup in the installed Akeneo-system? The system I tested with, might have been setup to use UUIDs as identifiers at install, so products don't seem to have an attribute "identifier" while other, (possibly older) systems might be setup to use "identifier" as the actual identifier with UUIDs being retrofitted, so both attributes ("identifier" and "uuid") exist on products?

Currently my workaround is to upload to the file to an asset, as linking an asset to an attribute of UUID-products seems to be working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions