how to PUT in Postman to change Woocommerce REST API meta_data

43 views Asked by At

I am trying to change a key-value pair in woocommerce using put in postman, but just cannot get ANY data to change.

I know it works from our ERP system, where I just put the key and value and it does its magic. But I want to learn and be able to test some other scenarios manually.

  1. I have set up the REST API consumer_key and consumer_secret in woo
  2. It is set to read AND write
  3. I can use a GET and get a correct reply with info
  4. Now I would like to PUT a specific meta_data field.
  5. I am on the correct server (checked the url) and I get Status 200ok, but nothing changes

Assuming this is the reply from GET (just made it shorter)

   {
        "id": 123445,
        "name": "Productname",
        "meta_data": [
            {
                "id": 121796,
                "key": "_product_checkbox",
                "value": "0"
            }
        ]
    }

I actually want to change the value of _product_checkbox, but even if I try just name, I have no success.

These are my PUT settings:

staging102.ourdomain.com/wp-json/wc/v3/products/123445?consumer_key=ck_something&consumer_secret=cs_somethingelse

and then I tried in Body > raw > JSON

{"name":"Postmantest"}

and also separately

{
    "meta_data": [
        {
            "key": "_product_checkbox",
            "value": "1"
        }
    ]
}

It always returns with status 200 and ok, but there is just nothing at all happening. What am I doing wrong, what have I missed?

Thanks!

0

There are 0 answers