wc-api-python icon indicating copy to clipboard operation
wc-api-python copied to clipboard

Issue using POST to batch update products

Open noahcramer opened this issue 2 years ago • 1 comments

I am attempting to batch update prices for products, this is just a small example to test updating using the batch method: When I swap the POST for PUT I get a 200, but nothing gets updated

`wcapi = WCAPI( url=site_url, consumer_key=wc_ck, consumer_secret=wc_sk, wp_api=True, version="wc/v3", query_string_auth=True )

test_json = { "update": [ { "id": 1675, "price": "8042.0", "regular_price": "8042.0" } ] }

print(wcapi.post("products/batch", test_json).json())`

This returns a 404: {'code': 'rest_no_route', 'message': 'No route was found matching the URL and request method.', 'data': {'status': 404}}

However, when I use get in something like this it works just fine and returns products wcapi.get("products").json()

My API key is read/write enabled.

Any help is appreciated. Thanks

noahcramer avatar Jan 11 '23 23:01 noahcramer

Please go to wp settings, and apply pemalinks type any except Plain

https://woocommerce.com/document/woocommerce-rest-api/#section-1

clever-giraffe avatar Jul 31 '23 12:07 clever-giraffe