woocommerce offtopic – Woo Commerce Bad Request 400 for Categories endpoint

Question

I’m accessing the Woo Commerce REST API using python. I’m using this library: https://pypi.org/project/WooCommerce/ as suggested by Woo Commerce Developers in the documentation. I’m trying to access the categories endpoint, to create new categories. Here is my request:

data = {
        "name": category_name,
        "parent": parent_category,
    }

request = woo_api.post("products/categories", data)

I then get a 400 Bad Request error, here are the details of the request:

request info
url: https://www.example.com/wp-json/wc/v3/products/categories
key: ck_****
secret: cs_****
data: {'name': 'Bags & Luggage', 'parent': 0}
timeout: 50
reason: Bad Request
code: <Response [400]>

Any ideas about what I’m doing wrong and how to fix this issue. Thanks

0
TheSunbathingCrow 2 months 2022-12-10T12:01:06-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse