1

I'm looking at the API in magento 2.3 and I'm trying to figure out how they works. I called a GET on /rest/it/V1/products/:sku and I got a JSON (stripped out for clarity)

{
    "extension_attributes": {
        "marketing1_title": "This is the marketing title 1",
    },
    "custom_attributes": [
        {
            "attribute_code": "marketing1_title",
            "value": "This is the marketing title 1"
        }
    ]
}

This product was created in the backend (I'm not familiar at all with it, I only work with the API) so I don't understand if it's a misconfiguration in the backend or if it's supposed to work this way.

Mainly I can't get the difference between "extension_attributes" and "custom_attributes" and I can't find any docs about it.

Can you help me in any way?

  • Magento's documentation for Extension Attributes vs Custom Attributes are here - https://devdocs.magento.com/guides/v2.3/extension-dev-guide/attributes.html. Ext Attrs are new in M2. It's a difference in how and why they are created. – rain2o Feb 27 '19 at 09:48
  • @rain2o if you put your comment as an answer I'll accept it – Federico Granata Feb 28 '19 at 08:57

1 Answers1

2

Magento's documentation regarding Custom Attributes and Extension Attributes can be found here https://devdocs.magento.com/guides/v2.3/extension-dev-guide/attributes.html.

For the sake of a verbose answer and in the case the link breaks in the future, below is a direct quote from their documentation.

Custom attributes are those added on behalf of a merchant. For example, a merchant might need to add attributes to describe products, such as shape or volume. A merchant can add these attributes in the Magento Admin panel.

Extension attributes are new in Magento 2. They are used to extend functionality and often use more complex data types than custom attributes. These attributes do not appear in the Magento Admin.

rain2o
  • 465
  • 6
  • 12