Skip to content

Permanent Redirect for old URL missing via API #8957

@MarcoGrecoIttweb

Description

@MarcoGrecoIttweb

Preconditions

Magento 2.1.2 CE
Multiple websites configured

Steps to reproduce(working):

  • go in admin area
  • clear url-key field in product
  • keep checked "Create Permanent Redirect for old URL"
  • changes product name
  • save

Steps to reproduce(broken):

  • call myownmagento.test/index.php/rest/all/V1/products with correct authentication token with json data and url_key_create_redirect or save_rewrites_history to 1
    example with sample data:

{"product":{"sku":"WSH10","name":"Ana Running Short changed","attribute_set_id":9,"price":0,"status":1,"visibility":4,"type_id":"configurable","weight":"0.1","extension_attributes":{"configurable_product_links":[2016,2017,2018,2019,2020,2021],"stock_item":{"use_config_enable_qty_inc":false,"manage_stock":true,"is_in_stock":true}},"custom_attributes":[{"attribute_code":"tax_class_id","value":2},{"attribute_code":"required_options","value":1},{"attribute_code":"has_options","value":1},{"attribute_code":"category_ids","value":["254"]},{"attribute_code":"description","value":"Test"},{"attribute_code":"url_key","value":""},{"attribute_code":"url_key_create_redirect","value":1}]}}

Expected result

  1. old product url is redirected to new one

Actual result

  1. old url go in 404 error

Some additionals notes:

I noticed that in admin area saving product and import there is a url_key_create_redirect check by code to force the url redirection that missing completely in API feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CatalogUrlRewriteComponent: Framework/WebapiUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just CatalogFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: 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 developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions