M
M
mihanches2018-05-11 11:16:31
API
mihanches, 2018-05-11 11:16:31

How to set up access to the site to WordPress via Api through WooCommerce?

Hello!
I didn’t have to program in PHP, so I clarify on this forum thread.
I am developing mobile applications for Android. Now the project is an online store. The idea is that product information (title, description, price, etc.) will be pulled from your site, made on WordPress.
Installed WP REST API and WooCommerce plugins. The link site.ru/wp-json/wc/v2 has the required category - products, from where you can "hook" information on products, but when you go to the link site.ru/wp-json/wc/v2/products, it happens mistake:

code    "woocommerce_rest_cannot_view"
message "Вы не можете просматривать список ресурсов."
data    
status  401

I understand that by default it is that not everyone can go to "products" and other categories from WooCommerce. Is it possible to specify somewhere in the code that access is allowed to everyone? Or any other methods how to get around this error.
Thanks to all who responded.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2018-05-11
@mihanches

Installed WP REST API plugins

You do not need to install it, it has long been part of the WP core, and this plugin has already been deprecated.
By access:
woocommerce.github.io/woocommerce-rest-api-docs/#a...
woocommerce.github.io/woocommerce-rest-api-docs/?p...
In the same documentation:
401 Unauthorized – Authentication or permission error, eg incorrect API keys

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question