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

Issue using POST to batch update products #85

Open
noahcramer opened this issue Jan 11, 2023 · 1 comment
Open

Issue using POST to batch update products #85

noahcramer opened this issue Jan 11, 2023 · 1 comment

Comments

@noahcramer
Copy link

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

@clever-giraffe
Copy link

clever-giraffe commented Jul 31, 2023

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

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

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