Skip to content

Category API should support save_rewrites_history for consistency reasons #29174

Closed
@amenk

Description

@amenk

Description

When updating category URL keys via REST API there is no possibility to automatically create 301 redirects for the old URL key to the new one.

For products this is possible

Expected behavior (*)

contents of category-rename.json

 {"category":{"name":"new name","is_active":1,"parentId":2366,"custom_attributes":[{"attribute_code":"url_key","value":"new name"},{"attribute_code":"save_rewrites_history","value":1}]}}

When making a API call like

 curl -k -X PUT $BASEURL/rest/V1/categories/1295  -H 'Content-Type: application/json' -H "Authorization: Bearer $BEARER" -d @category-rename.json

I expect that a new entry is created a the end of url_rewrite database table with the old url_key redirecting to the new category.
Instead, after the API call, I cannot find the URL key anywhere in the url_rewrite table.

Benefits

There are shops which are managed by PIM systems via API. Here it is important for SEO reasons, to allow renaming the URL key without loosing old links.

Additional information

There was already a pull request implementing something similar, but without the option to not create rewrites.
#18408

The save_rewrites_history is supported for products. So for consistency this should also be possible for categories.

Maybe I can be implemented similarly to \Magento\CatalogUrlRewrite\Plugin\Webapi\Controller\Rest\InputParamsResolver::afterResolve

Metadata

Metadata

Assignees

Labels

Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.feature request

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions