I am building a webshop with React, Wordpress v4 and Woocommerce Rest api v2.
I am a bit confused on how to proceed with authentication. I understand that for some requests like place an order or create a new product I need to authenticate.
But I also need to be able to just retrieve all products for a customer who visits the site for the first time and just wants to browse through all our products.
What is the best practice here?
My thoughts are:
GET
GET /products
POST /orders
add_action( 'rest_api_init',...
Okay, somehow I was thinking the wrong way. As wordpress lists all products which were created in woocommerce as a regular Wordpress post with post-type product
, I just have to make a request to the Wordpress API (NOT the Woocommerce API!), in my example:
http://laflor.wordpress.local/wp-json/wp/v2/product