WooCommerce REST API请求返回错误 [英] WooCommerce REST API request returns error
问题描述
我正在开发一个购物车网站和一个应用程序.我想从我的应用程序数据库中获取产品详细信息,所以我最近使用了JSON REST API(WP API),以及最新版本的 WooCommerce 2.1.
I'm developing a shopping cart Site and an App. I want to get product details from DB for my App, So I have recently used JSON REST API (WP API), And also latest version of WooCommerce 2.1.
当我运行网址http://ishop/wc-api/v1/
时,我得到了一个长长的json输出,
因此,我可以确保API正常运行.
When I run my url http://ishop/wc-api/v1/
I get a long json output,
So I can make sure the API is working fine.
但是,当我通过这样的请求时:
However when I pass a request like this:
http://ishop/wc-api/v1/products?consumer_key=ck_asd78465&consumer_secret=cs_d75412
错误:
{"errors":[{"code":"woocommerce_api_authentication_error","message":"oauth_consumer_key parameter is missing"}]}
我的语法有问题吗?请帮助大家.
Anything wrong in my syntax? Please help guys.
推荐答案
You have to use ether HTTPS or a OAuth signature as described here: http://woothemes.github.io/woocommerce/rest-api/#authentication
如果要使用HTTP,则有一个客户端库可以帮助您进行签名.您可以在此处找到该库: https://github.com/kloon/WooCommerce- REST-API-客户端库
There is a client library that can help you with the signature if you want to use HTTP. You can find the library here: https://github.com/kloon/WooCommerce-REST-API-Client-Library
这篇关于WooCommerce REST API请求返回错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!