I want to add a product using REST API but don't know how should I do. could you please help me what should I do? Magento 2.1 I use. this is the code that i used:
{
"id": 989898989989989898,
"sku": "5",
"name": "simple test",
"attribute_set_id": 23,
"price": 25000,
"status": 1,
"visibility": 4,
"type_id": "simple",
"created_at": "2019-07-02 11:00:15",
"updated_at": "2019-07-02 11:50:25",
"weight": 10,
"extension_attributes": {
"stock_item": {
"item_id": 998989898989898,
"product_id": 98989898989899898989898,
"stock_id": 1,
"qty": 5,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 10000,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": false,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
}
},
"product_links": [],
"options": [],
"media_gallery_entries": [
{
"id": 6034,
"media_type": "image",
"label": null,
"position": 1,
"disabled": false,
"types": [
"small_image",
"thumbnail",
"swatch_image"
],
"file": "/1/5/87987.jpg"
},
{
"id": 6035,
"media_type": "image",
"label": null,
"position": 2,
"disabled": false,
"types": [],
"file": "/1/5/656565.jpg"
}
],
"tier_prices": [],
"custom_attributes": [
{
"attribute_code": "description",
"value": "<ul><li>des test</li></ul>"
},
{
"attribute_code": "short_description",
"value": "<ul><li>shhort desc</ul>"
},
{
"attribute_code": "small_image",
"value": "/1/5/1540017-5714-7100451-3.jpg"
},
{
"attribute_code": "thumbnail",
"value": "/1/5/1540017-5714-7100451-3.jpg"
},
{
"attribute_code": "category_ids",
"value": [
"418",
"419",
"2256",
"2257"
]
},
{
"attribute_code": "options_container",
"value": "container1"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "url_key",
"value": "4"
},
{
"attribute_code": "gift_message_available",
"value": "0"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "swatch_image",
"value": "/1/5/1540017-5714-7100451-3.jpg"
},
{
"attribute_code": "sm_featured",
"value": "0"
},
{
"attribute_code": "udropship_calculate_rates",
"value": "0"
},
{
"attribute_code": "udropship_vendor",
"value": "5"
},
{
"attribute_code": "udtiership_use_custom",
"value": "1"
},
{
"attribute_code": "udtiership_rates",
"value": [
{
"rate_id": "5",
"product_id": "4036",
"delivery_type_id": "13",
"customer_shipclass_id": "475",
"customer_group_id": "*",
"cost": "222000.0000",
"additional": "0.0000",
"handling": "0.0000",
"sort_order": "0"
}
]
},
]
}
but get below error
{
"message": "%fieldName is a required field.",
"parameters": {
"fieldName": "product"
}
}
on this URL
/rest/default/V1/products