Hi @developersuseonly ,
The WooCommerce Rest API doesn’t allow for CRUD operations on the API keys themselves — you can find details of all the supported operations here: https://woocommerce.github.io/woocommerce-rest-api-docs/
What you’re trying to achieve would require custom development.
Hi, thanks for the response.
Actually I want to delete API keys when store deleted from my app, because when every time I create store then it creates new API key, so I want to delete API key when I’m deleting store.
Thanks.
Hi @developersuseonly ,
At the moment, you can delete the API keys directly form the WordPress site dashboard (under WP Admin > WooCommerce > Settings > Advanced). As mentioned earlier, there isn’t a way to delete the API key using Rest API, however, it may be possible to implement a custom solution via code for this. For custom solution, I recommend collaborating with a developer.
Hi,
thanks, I know I can delete directly from WooCommerce settings.
Can you please explain How can I achieve this with custom solution, I’m developer so you can explain me.
Thanks.
con
(@conschneider)
Engineer
Hi @developersuseonly,
WordPress allows you to add your own REST API endpoints. https://developer.ww.wp.xz.cn/rest-api/extending-the-rest-api/adding-custom-endpoints/
Basically what you can do is to either expose the CRUD functions of WooCommerce to an endpoint or create your own callback functions that manage what you need and then attach them to your custom endpoint.
Kind regards,