Skip to content

REST on barebones Magento Server – Creating a product doesn’t show ANY Price–even the base one

I have a docker instance of magento running. I’m using the latest image.

Here’s the post request to create a product:

curl --request POST 
  --url http://localhost/rest/V1/products 
  --header 'Authorization: Bearer <token>' 
  --header 'Content-Type: application/json' 
  --data '{
    "product": {
        "sku": "pain_and_anguish",
        "name": "Pain and anguish",
        "attribute_set_id": 4,
        "status": 1,
        "visibility": 1,
        "type_id": "Default",
        "price": 666.66
    }
}'

I get this response back:

{
    "id": 9,
    "sku": "pain_and_anguish",
    "name": "Pain and anguish",
    "attribute_set_id": 4,
    "status": 1,
    "visibility": 1,
    "type_id": "Default",
    "created_at": "2023-02-21 23:27:52",
    "updated_at": "2023-02-24 02:32:44",
    "extension_attributes": {
        "website_ids": [
            1
        ],
        "stock_item": {
            "item_id": 9,
            "product_id": 9,
            "stock_id": 1,
            "qty": 0,
            "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": true,
            "manage_stock": true,
            "low_stock_date": null,
            "is_decimal_divided": false,
            "stock_status_changed_auto": 0
        }
    },
    "options": [],
    "media_gallery_entries": [],
    "custom_attributes": [
        {
            "attribute_code": "options_container",
            "value": "container2"
        },
        {
            "attribute_code": "url_key",
            "value": "pain-and-anguish"
        },
        {
            "attribute_code": "gift_message_available",
            "value": "0"
        },
        {
            "attribute_code": "required_options",
            "value": "0"
        },
        {
            "attribute_code": "has_options",
            "value": "0"
        },
        {
            "attribute_code": "category_ids",
            "value": []
        }
    ]
}

However, note: there’s no price field as promised.

Even when I GET the product:

curl --request GET 
  --url http://localhost/rest/V1/products/pain_and_anguish 
  --header 'Authorization: Bearer <token>'

There’s still no price:

{
    "id": 9,
    "sku": "pain_and_anguish",
    "name": "Pain and anguish",
    "attribute_set_id": 4,
    "status": 1,
    "visibility": 1,
    "type_id": "Default",
    "created_at": "2023-02-21 23:27:52",
    "updated_at": "2023-02-24 02:32:44",
    "extension_attributes": {
        "website_ids": [
            1
        ],
        "stock_item": {
            "item_id": 9,
            "product_id": 9,
            "stock_id": 1,
            "qty": 0,
            "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": true,
            "manage_stock": true,
            "low_stock_date": null,
            "is_decimal_divided": false,
            "stock_status_changed_auto": 0
        }
    },
    "product_links": [],
    "options": [],
    "media_gallery_entries": [],
    "tier_prices": [],
    "custom_attributes": [
        {
            "attribute_code": "options_container",
            "value": "container2"
        },
        {
            "attribute_code": "url_key",
            "value": "pain-and-anguish"
        },
        {
            "attribute_code": "gift_message_available",
            "value": "0"
        },
        {
            "attribute_code": "required_options",
            "value": "0"
        },
        {
            "attribute_code": "has_options",
            "value": "0"
        },
        {
            "attribute_code": "category_ids",
            "value": []
        }
    ]
}

I don’t see the price in the web interface either.

The Default attribute set does have a price field, and it is enabled, yet, it doesn’t show up.

I’ve scoured forums and other SO posts. I only see posts about configurable products. I couldn’t find another endpoint that would GET anything remotely close to a price.

Any help is appreciated. Thank you.