PipedreamHQ / pipedream

Connect APIs, remarkably fast. Free for developers.
https://pipedream.com
Other
8.88k stars 5.27k forks source link

[ACTION] Akeneo: Create a new Product Media file #4824

Closed vunguyenhung closed 1 year ago

vunguyenhung commented 1 year ago

Is there a specific app this action is for? Akeneo

Please provide a link to the relevant API docs for the specific service / operation. https://api.akeneo.com/api-reference.html#post_media_files

anzglr commented 1 year ago

Hi folks!

Thank you on behalf of the Akeneo Solution Engineering team for the effort to create a dedicated action! I'm sure it will help us and our users a lot.

Do you happen to know when this action will be completed? Is there anything I might be able to help you with?

feyzullah commented 1 year ago

Hi @anzglr, I am adding product or product_model to the FormData but it always returns something like You should at least give one of the following properties: "product" or "product_model". Can you please have a look at this draft PR? I need help here for sure, thank you very much!

anzglr commented 1 year ago

Hi @feyzullah, that is a bit too technical for me, as I am not a developer. But I can probably find some answers, as long as there is a concrete question to forward.

I found this, which seems to cover the same issue. Maybe it helps. Or is it from you? The timing would match :)

https://github.com/akeneo/pim-community-dev/issues/18578

feyzullah commented 1 year ago

Hi @anzglr, with your help I managed to solve that error, thank you very much! However, when I try to create a new product media file, every attribute raises another error. Let me clarify this with examples; {attribute: 'ak_allergenes', scope: null, locale: null, identifier: '102774'} raises {"code":422,"message":"Property \"ak_allergenes\" expects an array as data, \"string\" given."} {attribute: '3d_technology', scope: null, locale: null, identifier: '102774'} raises {"code":422,"message":"Property \"3d_technology\" expects a boolean as data, \"string\" given."} Should not it be given as {"identifier":"product_identifier", "attribute":"attribute_code", "scope":"channel_code","locale":"locale_code"}? I send data in this format because I saw it here I am using attribute codes fetched from https://api.akeneo.com/api-reference.html#get_attributes. Am I using wrong attributes codes? If so which attribute codes should be used? If not what should be sent in data payload? Thank you very much!

anzglr commented 1 year ago

What environment are you using for testing?

You can only upload image files to image attributes and other files to file attributes on the products itself. In the Akeneo Enterprise Edition there is also the possibility to create independent assets that can then be linked to (multiple) products.

Your examples don't look like image attributes to me. One is probably a multi-select attribute used to select allergens and the other one is a boolean attribute to flag the availability of a certain product feature.

The attributes will vary from system to system. You will have to make the attribute code a variable.

To find the image attributes in your test system, use this in Postman: {{url}}/api/rest/v1/attributes?search={"type":[{"operator":"IN","value":["pim_catalog_image"]}]}

feyzullah commented 1 year ago

Hi @anzglr, now this action seems to be working correctly thanks to your support. Now it returns a success code. There will be some quality checks and then we will merge. I have my last question about the issue. The QA reviewer and I will need this information. How can uploaded media files be seen in Akeneo web app? Thank you very much!

anzglr commented 1 year ago

Hi @feyzullah. That's great!

The image should appear in the attribute you chose for the product it was added to. So go to this product and have a look at the list of attributes. I don't know the data model of your environment, so I can't be more precise. But it should look like in the screenshot attached.

Bildschirm­foto 2023-02-01 um 09 08 16
feyzullah commented 1 year ago

@anzglr thank you very much! It seems that the action is working since uploaded images are shown in product page.