英文:
PHP Curl additional parameters for Woocommerce API
问题
我能够使用默认的curl请求收集所有订单:
curl https://example.com/wp-json/wc/v3/orders -u consumer_key:consumer_secret
但我想要添加一些参数,但不确定如何添加。我尝试将其添加到URL中,但没有成功:
curl https://example.com/wp-json/wc/v3/orders?status=completed&after=2023-06-01T00:00:00-00:00 -u consumer_key:consumer_secret
我尝试使用-d '{"status":"completed"}'
,但似乎这会创建一个订单(即使我没有规定-X POST或PUT)。
非常感谢任何帮助。谢谢。
英文:
I'm able to collect all orders using the default curl request:
curl https://example.com/wp-json/wc/v3/orders -u consumer_key:consumer_secret
But what I want to add a couple parameters and unsure how. I have tried adding it to the url, but with no luck:
curl https://example.com/wp-json/wc/v3/orders?status=completed&after=2023-06-01T00:00:00-00:00 -u consumer_key:consumer_secret
I did try using -d '{"status":"completed"}'
, but this seemed to create an order (even though I have not stipulated -X POST or PUT
Any help would be greatly appreciated. Thanks
答案1
得分: 1
需要将URL放在引号内。执行curl命令如下:
curl "https://example.com/wp-json/wc/v3/orders?status=completed&after=2023-06-01T00:00:00-00:00" -u consumer_key:consumer_secret
英文:
You'll need to wrap the URL inside quotes. Execute the curl command like this:
curl "https://example.com/wp-json/wc/v3/orders?status=completed&after=2023-06-01T00:00:00-00:00" -u consumer_key:consumer_secret
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论