Skip to content

2.3 only - creating attribute option value using API returns unexpected response #18392

Closed
@hostep

Description

@hostep

Preconditions

  1. Tested with 2.4-develop branch
  2. PHP 7.1.22 & 7.2

Steps to reproduce

  1. Setup a clean Magento installation
  2. Create an Integration with full access rights & activate it, I'm assuming the access token is abcd (see step 4)
  3. Using the adminhtml, create a new dropdown product attribute, use attribute code: dropdown
  4. Add an option through a REST call (make sure to use an option which doesn't exist yet):
curl -k -X POST "https://domain.tld/rest/all/V1/products/attributes/dropdown/options" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer abcd" -d "{ \"option\": { \"label\": \"whatever\" }}"

Expected result

  1. Return value should be the ID of the new option

Actual result

  1. Return value is "id_new_option"
    image

Further discussion

This is a follow up on #8810, this issue was supposed to be fixed by #12920
But here's what seemed to have happened:

  • The above PR was first returning the full attribute option data with the label and the ID in JSON format.
  • But @okorshenko remarked in his review that only the ID should be returned.
  • @sidolov then added commit 5eef1d9 which turned the return value (probably accidentally) into: "new_option"
  • And then @sidolov added another commit (ac48c86) which now returns: "id_new_option"

This was probably all done by accident, I'm opening this issue so this isn't getting forgotten.

Metadata

Metadata

Assignees

Labels

CDIssue recommended for the contribution dayComponent: CatalogComponent: EavEvent: mageconfIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions