I need to understand the following situation:
External systems must send a JSON structure (almost similar to the default magento structure) using Web-API to import / update products (POST / PULL).
The structure differs from the default structure because the custom attributes are flat in the JSON and not in an array (custom_attributes).
So, the default endpoint: (PUT) / rest / V1 / products /: sku and the interface for the method "save" Magento Catalog Api Data ProductInterface can not
understand the attributes.
Is it possible to reformat / normalize the JSON structure before the request reaches the initialization of Magento Catalog Api Data ProductInterface?
I'm also trying the solution to create a custom endpoint:
with a custom backup
public function save ( Itc API Api Data ProductInterface $ product, $ saveOptions = false);
This interface Itc Api Api Data ProductInterface contains all the methods of obtaining / defining such as those that the custom JSON needs.
The endpoint usually works, but magento generates an error:
Fatal error: Unplayed Error: Unable to Instantiate the Itc Api Api Data ProductInterface Interface in /app/web/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
I think the best way is to reformat the structure and use the
end point of origin.
Thanks for the help,