How to Create WooCommerce Subscription Product via. REST API?



PHP Snippet 1:

{
    "name": "simple sub api",
    "type": "subscription",
    "status": "publish",
    "featured": false,
    "catalog_visibility": "visible",
    "description": "sub desc",
    "short_description": "sub short",
    "sku": "",
    "price": "10",
    "regular_price": "10",
    "sale_price": "",
    "date_on_sale_from": null,
    "date_on_sale_from_gmt": null,
    "date_on_sale_to": null,
    "date_on_sale_to_gmt": null,
    "on_sale": false,
    "purchasable": true,
    "total_sales": 3,
    "virtual": false,
    "downloadable": false,
    "downloads": [],
    "download_limit": -1,
    "download_expiry": -1,
    "external_url": "",
    "button_text": "",
    "tax_status": "taxable",
    "tax_class": "",
    "manage_stock": false,
    "stock_quantity": null,
    "backorders": "no",
    "backorders_allowed": false,
    "backordered": false,
    "low_stock_amount": null,
    "sold_individually": false,


    "meta_data": [
        {
            "key": "_subscription_payment_sync_date",
            "value": "0"
        },
        {
            "key": "_subscription_price",
            "value": "10"
        },
        {
            "key": "_subscription_trial_length",
            "value": "1"
        },
        {
            "key": "_subscription_sign_up_fee",
            "value": ""
        },
        {
            "key": "_subscription_period",
            "value": "month"
        },
        {
            "key": "_subscription_period_interval",
            "value": "1"
        },
        {
            "key": "_subscription_length",
            "value": "0"
        },
        {
            "key": "_subscription_trial_period",
            "value": "month"
        },
        {

            "key": "_subscription_limit",
            "value": "no"
        },
        {
            "key": "_subscription_one_time_shipping",
            "value": "no"
        }
    ],
    "stock_status": "instock"
}