Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant update custom meta via curl #15

Open
russwittmann opened this issue Jun 27, 2016 · 7 comments
Open

Cant update custom meta via curl #15

russwittmann opened this issue Jun 27, 2016 · 7 comments

Comments

@russwittmann
Copy link

Currently I'm trying to update my site meta using curl if I try this:
curl -X PUT https://dev.domain.com/wc-api/v3/products/241074 -u key:secret -H "Content-Type: application/json" -d '{"product":{"meta": {"my_availability":"S"}}}'
and it doesn't work, although a regular update works
curl -X PUT https://dev.domain.com/wc-api/v3/products/241074 -u key:secret -H "Content-Type: application/json" -d '{"product":{"regular_price": "9000.00"}}' of a normal woo field, I'm so close but I just can't get it, any help is appreciated

@judgej
Copy link
Owner

judgej commented Jun 28, 2016

Should it be custom_meta rather than meta? I left meta free for core WC use.

@russwittmann
Copy link
Author

russwittmann commented Jun 28, 2016

its definitely called meta here is the results of just a query. and All I need to change is "my_availability" to "S"

{
    "product":{
        "title":"GOLD $20 LIBERTY",
        "id":241074,
        "created_at":"2016-06-19T17:28:38Z",
        "updated_at":"2016-06-19T17:28:38Z",
        "type":"simple",
        "status":"publish",
        "downloadable":false,
        "virtual":false,
        "permalink":"https:\/\/dev.monacorarecoins.com\/coin\/gold-20-liberty-id241074\/",
        "sku":"",
        "price":"9000.00",
        "regular_price":"9000.00",
        "sale_price":null,
        "price_html":"<span class=\"amount\">&#36;9,000.00<\/span>",
        "taxable":true,
        "tax_status":"taxable",
        "tax_class":"",
        "managing_stock":false,
        "stock_quantity":null,
        "in_stock":true,
        "backorders_allowed":false,
        "backordered":false,
        "sold_individually":false,
        "purchaseable":true,
        "featured":false,
        "visible":true,
        "catalog_visibility":"visible",
        "on_sale":false,
        "product_url":"",
        "button_text":"",
        "weight":null,
        "dimensions":{
            "length":"",
            "width":"",
            "height":"",
            "unit":"cm"
        },
        "shipping_required":true,
        "shipping_taxable":true,
        "shipping_class":"",
        "shipping_class_id":null,
        "description":"",
        "short_description":"",
        "reviews_allowed":true,
        "average_rating":"0.00",
        "rating_count":0,
        "related_ids":[
            3898,
            301520,
            991,
            27250,
            338
        ],
        "upsell_ids":[

        ],
        "cross_sell_ids":[

        ],
        "parent_id":0,
        "categories":[
            "$20 Double Eagle",
            "$20 Gold Liberty Double Eagles For Sale",
            "Best Values",
            "Buy Type I $20 Liberties",
            "Gold Double Eagles"
        ],
        "tags":[
            "1853"
        ],
        "images":[
            {
                "id":0,
                "created_at":"2016-06-28T16:49:01Z",
                "updated_at":"2016-06-28T16:49:01Z",
                "src":"https:\/\/dev.mydomain.com\/wp-content\/plugins\/woocommerce\/assets\/images\/placeholder.png",
                "title":"Placeholder",
                "alt":"Placeholder",
                "position":0
            }
        ],
        "featured_src":"",
        "attributes":[

        ],
        "downloads":[

        ],
        "download_limit":0,
        "download_expiry":0,
        "download_type":"",
        "purchase_note":"",
        "total_sales":0,
        "variations":[

        ],
        "parent":[

        ],
        "grouped_products":[

        ],
        "menu_order":0,
        "meta":{
            "ebar_coin_id":"241074",
            "ebar_search_title":"GOLD $20 LIBERTY",
            "my_availability":"Y",
            "ebar_grade":"MS61",
            "ebar_grading_service":"NGC",
            "ebar_date_mint":"1853",
            "ebar_comod":"DEL",
            "ebar_condition":"MS61",
            "ebar_coin_description":"GOLD $20 LIBERTY",
            "ebar_pcgs_number":"",
            "ebar_cert_number":"01890861003643203003",
            "ebar_code":"DEL",
            "ebar_key":"N",
            "ebar_finest":"N",
            "ebar_numis":"9470",
            "ebar_cu3000":"0008250",
            "ebar_top100":"N",
            "ebar_featured":"N",
            "ebar_notes":"7\/15 AUC=$10,350",
            "ebar_valued":"Y",
            "ebar_ship":"N",
            "ebar_year":"1853",
            "_wc_rating_count":[

            ],
            "_wc_average_rating":"0"
        }
    }
}

JDJ: formatted for clarity.

@judgej
Copy link
Owner

judgej commented Jul 2, 2016

Sorry, I'm getting the dreaded "Consumer Secret is invalid" message on my instance, after some server upgrades, and run out of time trying to work around that problem.

Can you confirm that you did try custom_meta as the name of the object to send custom metadata fields to?

@russwittmann
Copy link
Author

Correct it doesn't work with custom_meta. If you want I can give you access to my instance?

@judgej
Copy link
Owner

judgej commented Jul 3, 2016

Give me a day or two to get it working at my end. I do need a working system if I'm going to be able to do anything useful here.

@russwittmann
Copy link
Author

Any luck?

@judgej
Copy link
Owner

judgej commented Aug 2, 2017

Use the new v2 REST API (WC 3.x) instead of this plugin. It now does everything this plugin does out of the box. The README gives some examples of how you would manage the metadata fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants