ACSD-63329: Default values for date and time fields aren’t set when creating products with the REST API
- Topics:
- REST
CREATED FOR:
- Experienced
- Admin
- Developer
The ACSD-63329 patch fixes the issue where default values were not set for the date and time fields when creating a new product using REST API: /rest/default/V1/products
. This patch is available when the Quality Patches Tool (QPT) 1.1.58 is installed. The patch ID is ACSD-63329. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.8.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.6
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.4 - 2.4.7-p3
magento/quality-patches
package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
Default values aren’t set for the date and time fields when creating products with the REST API: /rest/default/V1/products
Steps to reproduce:
-
Create a Product attribute, set its default value to
12/31/2020
, and set the Catalog Input Type for Store Owner to Date or Date and Time. -
Create another text type attribute and set the default value to test value.
-
Create a new product using a REST API POST request to
/rest/all/V1/products/
.{ "product": { "sku": "testsku2", "name": "Test Api Product 2", "attribute_set_id": 4, "price": 100, "status": 1, "visibility": 4, "type_id": "simple", "weight": 20, "extension_attributes": { "website_ids": [ 1 ] } } }
-
Check the values saved for the attributes mentioned above.
Expected results:
The default value should be saved in Date/Datetime type attributes when creating a product using the API.
Actual results:
The default value is saved for the Text attribute but not for the Date type attribute. The value for the Date attribute is empty.
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide.
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide.
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide.