Szymon Blaszczynski Szymon Blaszczynski - 2 months ago 24
Ruby Question

Can't login to my WooCommerce instance from python and ruby API wrappers

I've been hacking something in

Wordpress
, when I felt strange need to use API's and found one at
WooCommerce
plugin. Unfortunately I can't get it going the right way, as it's giving me the same result, whatever it's Python wrapper or Ruby wrapper -

wapi = WooCommerce::API.new(
"http://myapp.rhcloud.com",
"ck_xxxxxxxxx",
"cs_xxxxxxxxx",
{
wp_api: true,
version: "wc/v1"
}
)
=> #<WooCommerce::API:0x007fb2bb0a6840 @url="http://myapp.rhcloud.com", @consumer_key="ck_xxxxxxxxx", @consumer_secret="cs_xxxxxxxxx", @wp_api=true, @version="wc/v1", @verify_ssl=true, @signature_method="HMAC-SHA256", @is_ssl=false>

print wapi.get("")
{"code"=>"rest_no_route", "message"=>"No route was found matching the URL and request method", "data"=>{"status"=>404}}=> nil


Please help me get this going on... Wordpress is fresh provisioned from OpenShift cartridges and I can do everything manually, but you know where the fun is?

Answer

Update: Since version 2.6 use this instead:

wapi = WooCommerce::API.new(
  "http://myapp.rhcloud.com",
  "ck_xxxxxxxxx",
  "cs_xxxxxxxxx",
  {
    wp_api: true,
    version: "wc/v1"
  }
)

Question code is intended for WooCommerce version 2.6 to be released at June, 14, 2016.

As for today use this instead:

wapi = WooCommerce::API.new(
  "http://yoursite.com",
  "ck_xxx",
  "cs_xxx",
  {
    version: "v3"
  }
)
Comments