magento2: REST API multiselect attribute BC break between 2.1.8 and 2.3.0
Preconditions (*)
- Magento 2.4-develop
Steps to reproduce (*)
- Have a multiselect attribute
- Update the product data through the REST API and pass an array of IDs as a value for this multiselect attribute
Expected result (*)
- Attribute is updated (as it worked in 2.1.8)
Actual result (*)
- Error message is returned:
{
"message": "Error occurred during \"custom_attributes\" processing. Attribute \"equipment\" has invalid value. The \"array\" value's type is invalid. The \"string\" type was expected. Verify and try again.",
"trace": null
}
Workaround
Implode the ids and send them as a string. But it makes your code incompatible with Magento 2.1.8 as it expects an array of ids.
I guess that it is some kind of BC break, because Magento 2.1.8 works in a completely opposite way - it requires an array of IDs and rejects string with a message: {"message":"Error occurred during \"custom_attributes\" processing. Attribute \"equipment\" has invalid value. Invalid type for value: \"string\". Expected Type: \"string[]\"."}
Related issue: #6120
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 3
- Comments: 15 (5 by maintainers)
Commits related to this issue
- [UGLA-68] Fix updating REST product multiselect attribute https://github.com/magento/magento2/issues/21364 — committed to ConvertGroupsAS/magento2-patches by unicoder88 5 years ago
- [UGLA-68] Fix updating REST product multiselect attribute https://github.com/magento/magento2/issues/21364 — committed to ConvertGroupsAS/magento2-patches by unicoder88 5 years ago
- magento/magento2#21364 REST API multiselect attribute BC break between 2.1.8 and 2.3.0 — committed to engcom-Charlie/magento2 by engcom-Charlie 3 years ago
✅ Confirmed by @engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets
MAGETWO-98363
,MAGETWO-98364
were createdIssue Available: @engcom-backlog-nazar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.