I have created the custom attribute through rest API and it is also reflected in magento admin, after which when I tried to update the product with the attribute code.it won’t worked.
Below is my JSON for creating attribute code
$data = [
"attribute" => [
"is_wysiwyg_enabled" => false,
"is_html_allowed_on_front" => false,
"used_for_sort_by" => false,
"is_filterable"=> true,
"is_filterable_in_search"=> true,
"is_used_in_grid"=> true,
"is_visible_in_grid"=> false,
"is_filterable_in_grid"=> true,
"position"=> 0,
"apply_to"=> [],
"is_searchable"=> "1",
"is_visible_in_advanced_search"=> "1",
"is_comparable"=> "1",
"is_used_for_promo_rules"=> "0",
"is_visible_on_front"=> "1",
"used_in_product_listing"=> "1",
"is_visible"=> true,
"scope"=> "global",
"frontend_input"=> "text",
"entity_type_id"=> "4",
"is_required"=> false,
"is_user_defined"=> true,
"default_frontend_label"=> $attribute,
"frontend_labels"=> $attribute,
"backend_type"=> "varchar",
"default_value"=> "",
"is_unique"=> "0",
// 'attribute_set' => 'Default', // Specify the attribute set code
// 'attribute_group' => 'General',
]
];
This is for product updating for custom attribute
$data = [
"product" => [
"sku"=> $productsku,
// "attribute_set_id"=> 4,
//"attribute_set_id" => $mage_attr_set_id,
// "entity_type_id" => $entity_type_id,
"visibility" => 2,
// "custom_attributes" => $subArray
"custom_attributes" => [
[
"attribute_code" => "selling_unit_of_measure",
"value" => "each"
]
]
]
];