Skip to content

[Issue] #29174 Add save_rewrites_history to categories via API #30240

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #29205: #29174 Add save_rewrites_history to categories via API


Support save_rewrites_history to categories API

Preconditions (*)

  1. Magento 2.4-develop

Description (*)

See #29174

Fixed Issues (if relevant)

  1. Fixes Category API should support save_rewrites_history for consistency reasons #29174

Steps to reproduce (*)

  1. Go to Catalog - Categories and create a new Subcategory
  2. Open Swagger (http://magentositewname.domain/swagger)
  3. Generate Admin token via integrationAdminTokenServiceV1 POST /V1/integration/admin/token request
  4. Copy the generated token into api_key field and click **apply
    api_key_field
  5. Perform the catalogCategoryRepositoryV1 PUT /V1/categories/{id} request with the following Parameters:
  • id 2 (id of the previously created category)
  • body
{
    "category": {
    "id": 5,
    "parent_id": 2,
    "name": "new name",
    "is_active": true,
    "position": 0,
    "level": 0,
    "created_at": "string",
    "updated_at": "string",
    "path": "string",
    "include_in_menu": true,
    "extension_attributes": {},
    "custom_attributes": [
      {
        "attribute_code": "url_key",
        "value": "new name1"
      },{
        "attribute_code":"save_rewrites_history",
        "value":1
        }
      ]
     }
    }
  1. Verify if the Response body is correct.
    Example:
    resp_body
  2. Open database table url_rewrite

Actual result (*)

The old url_rewriew record has been removed, and only the new record existed
db_before11

db_before2

Expected result (*)

The previous record is not removed
db_after1

See example in #29174

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Component: CatalogUrlRewriteFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: 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: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced 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.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions