Can't connect with Woocommerce using WooCommerceNET C# because of version

Viewed 375

I am trying to connect with WooCommerce using API v2. I am using WooCommerceNET=0.8.1 and NETFramework=v4.7.2

Code:

using WooCommerceNET;
using WooCommerceNET.WooCommerce.v2;
using WooCommerceNET.WooCommerce.v2.Extension;

...
public void AddToWoocomerce()
        {
            string consumerKey = "ck_....";
            string consumerSecret = "cs_...";

            RestAPI rest = new RestAPI("http://makm862.vot.pl/wp-json/wp/v2/", consumerKey, consumerSecret);

            WCObject wc = new WCObject(rest);  
        }

I got exception:

Please use WooCommerce Restful API Version 2 url for this WCObject. e.g.: http://www.yourstore.co.nz/wp-json/wc/v2/

What I am doing wrong?

2 Answers

Your link is

wp/v2/

It should be:

wc/v2/

Yeah, that't right. I copied it from example with

WPObject wc = new WPObject(rest);  

not

WCObject wc = new WCObject(rest);  

and didnt noticed there is other url.

Sorry for such a trivial problem.

Related