WooCommerce REST API产品变体404

2024-04-26 10:58:19 发布

您现在位置:Python中文网/ 问答频道 /正文

设置

我经营一家WooCommerce网店,有几种产品,其中有些有产品变体。你知道吗

我使用WooCommerce REST API来调整我网店中的内容。你知道吗


我的代码

调用具有变体的产品

product = uk_wcapi.get('products/51369').json()

这个很好用。你知道吗

这个产品有几个变种

print(product['variations'])

给出所有变体:https://gist.github.com/LucSpan/8185fa540cdd4267744f6c49f4b2a698


问题

我似乎无法调用或编辑产品变体。你知道吗

explanation in the REST API documentation之后,当我试图编辑51369的第一个产品变体时 具有id52548,即

product_variation_1 = uk_wcapi.get('products/51369/variations/52548').json()

product_variation_1等于

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

我得到了上述任何产品的任何变化与变化的任何产品的错误。你知道吗

我做错什么了?你知道吗


Tags: therestapijson编辑get产品woocommerce