Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest API attribute set updating not working as expected #8194

Closed
NotAndD opened this issue Jan 19, 2017 · 4 comments
Closed

Rest API attribute set updating not working as expected #8194

NotAndD opened this issue Jan 19, 2017 · 4 comments
Assignees
Labels
bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@NotAndD
Copy link

NotAndD commented Jan 19, 2017

Preconditions

  1. Install Magento 2.1.3 with sample data.
  2. Set up Rest integration.

Steps to reproduce

  1. Try to update an attribute set from /V1/products/attribute-sets/{attributeSetId} with a PUT request, inserting in the body ONLY the not-optional parameters (as explained in the documentation).
{
"attribute_set": {
"attribute_set_name":"Updated Name",
"sort_order":0 }
}

and with an existing attribute set id as url parameter

Expected result

  1. The attribute set with given attribute set id gets updated with the new name

Actual result

  1. It doesn't get updated and magento answer with
    {"message":"Provided Attribute set non product Attribute set."}

Why

  1. Field entity_type_id is NOT optional in the PUT request, differently from what the documentation says.
  2. If field attribute_set_id is only in the url parameter and NOT in the body, instead of updating the attribute set, a new attribute set with the given fields is created.
  3. Only if both fields attribute_set_id and entity_type_id are given in the body, the request is succesful and the attribute set with the given id in the url parameter is updated.
@NotAndD NotAndD changed the title Rest API attribute set updating not working Rest API attribute set updating not working as expected Jan 19, 2017
@veloraven veloraven added 2.1.x bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog labels Jan 19, 2017
@magento-engcom-team magento-engcom-team added 2.1.x bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 6, 2017
@magento-engcom-team
Copy link
Contributor

@ziliquas, thank you for your report.
We've created internal ticket(s) MAGETWO-81147 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 11, 2017
@nmalevanec nmalevanec self-assigned this Jan 16, 2018
@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Apr 30, 2018
@magento-engcom-team
Copy link
Contributor

Hi @ziliquas. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1233 by @nmalevanec in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

@jannath-hussain
Copy link

use this api
/V1/eav/attribute-sets/:attributeSetId
with payload of
{
"attribute_set": {
"attribute_id" : 10, // whatever attributesetid u have..
"attribute_set_name":"Updated Name",
"sort_order":0 }
}

@anowave
Copy link

anowave commented Apr 17, 2019

I believe there is still an issue.

$result = $attributeSet->getEntityTypeId() === $productEntityId; is returning false because:

$productEntityId = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getId(); returns a string while

$attributeSet->getEntityTypeId() is an integer and the type comparison fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Framework/Webapi USE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

6 participants