Open anghelalexandra opened 5 years ago
Describe the bug REST API routes for retrieving products, categories, etc. are throwing an exception.
( [request:Automattic\WooCommerce\HttpClient\HttpClientException:private] => Automattic\WooCommerce\HttpClient\Request Object ( [url:Automattic\WooCommerce\HttpClient\Request:private] => .../wp-json/wc/v2/products/categories [method:Automattic\WooCommerce\HttpClient\Request:private] => GET [parameters:Automattic\WooCommerce\HttpClient\Request:private] => Array ( ) [headers:Automattic\WooCommerce\HttpClient\Request:private] => Array ( [Accept] => application/json [User-Agent] => WooCommerce API Client-PHP/1.3.0 ) [body:Automattic\WooCommerce\HttpClient\Request:private] => ) [response:Automattic\WooCommerce\HttpClient\HttpClientException:private] => Automattic\WooCommerce\HttpClient\Response Object ( [code:Automattic\WooCommerce\HttpClient\Response:private] => 401 [headers:Automattic\WooCommerce\HttpClient\Response:private] => Array ( [Server] => nginx [Date] => Fri, 10 Aug 2018 15:21:08 GMT [Content-Type] => application/json; charset=UTF-8 [Transfer-Encoding] => chunked [Connection] => keep-alive [X-Robots-Tag] => noindex [Link] => <.../wp-json/>; rel="https://api.w.org/" [X-Content-Type-Options] => nosniff [Access-Control-Expose-Headers] => X-WP-Total, X-WP-TotalPages [Access-Control-Allow-Headers] => Authorization, Content-Type [Set-Cookie] => pwacommerce_load_app=0; expires=Sun, 12-Aug-2018 15:21:08 GMT; Max-Age=172800; path=/ [X-Powered-By] => Loading ) [body:Automattic\WooCommerce\HttpClient\Response:private] => {"code":"woocommerce_rest_cannot_view","message":"Lo siento, no puedes listar los recursos.","data":{"status":401}}
To Reproduce Steps to reproduce the behavior:
Expected behavior Return JSON data so it can be used by the app.
WordPress / WooCommerce setup
Additional context Exception catching should also be added so the HTTP 500 status can be replaced with a user friendly message.
Describe the bug REST API routes for retrieving products, categories, etc. are throwing an exception.
To Reproduce Steps to reproduce the behavior:
Expected behavior Return JSON data so it can be used by the app.
WordPress / WooCommerce setup
Additional context Exception catching should also be added so the HTTP 500 status can be replaced with a user friendly message.