I have registered new custom routes for woocommerce rest api, using below code
const Product_Review = 'products/reviews/(?P<product_id>[\d]+)';
public function register_routes( $routes ) {
$routes[ self::Product_Review ] = array(array(
array( $this, 'create_product_review_item' ),
WC_API_Server::EDITABLE | WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA
));
return $routes;
}
this route is successfully registed as i'm able to see it in woocommerce endpoints like this :
But when i'm calling this api from javascript then it's give me this error:
{
"errors":[
{
"code":"woocommerce_api_no_route",
"message":"No route was found matching the URL and request method"
}
]
}
My URL :
http://angular.templatic.net/wc-api/v3/products/reviews/31?oauth_consumer_key=ck_9ae878f7a1fa134a2acad1eef7c0182dd3f7e68a&oauth_nonce=d3gf9k8KQXrzGV3LTugcVqrrdME6wzCz&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1481008886&oauth_version=1.0&oauth_signature=xahKi7PjaLxEUaJWPTUnewbI0JoJKYi2Vtn3L2KF1%2FM%3D
I want to use this routes for post method for insert data in db.