noemx Posted June 26, 2024 Share Posted June 26, 2024 Hi, I would like to automate Webservice configuration for PS 1.7 or 8 to allow automated test environment setup. The goal is to: Enable Webservice Add the Webservice key with all the permissions there are I've explored /bin/console but that doesn't seem to be able to do that, so I came here to ask. My last resort plan is to diff a DB dump before/after webservice configuration to see what SQL to apply to enable it, but I would like to avoid this (its ugly and could be version dependent). Would you have any hints how to achieve this? Link to comment Share on other sites More sharing options...
ZHSoft Posted June 26, 2024 Share Posted June 26, 2024 I think your last plan is the most feasible. Find out the SQL and collect it, and import it every time you need to test. As long as it is not a big version of PrestaShop upgrade, Webservice generally does not change, so you don't need to worry too much. It is good to do a necessary check every time you import SQL. Link to comment Share on other sites More sharing options...
noemx Posted July 5, 2024 Author Share Posted July 5, 2024 I got one step further, so posting progress. I'm actually able to enable webservice via bin/console like this: php bin/console prestashop:config --value 1 set PS_WEBSERVICE php bin/console prestashop:config --value 1 set PS_WEBSERVICE_CGI_HOST And add webservice key and permissions via SQL: INSERT INTO `ps_webservice_account` VALUES (1,'QWERTYUIOPASDFGHJKLZXCVBNM123456','My key name','WebserviceRequest',0,NULL,1) INSERT INTO `ps_webservice_account_shop` VALUES (1,1) INSERT INTO `ps_webservice_permission` VALUES (837,'addresses','GET',3) INSERT INTO `ps_webservice_permission` VALUES (838,'addresses','POST',3) INSERT INTO `ps_webservice_permission` VALUES (839,'addresses','DELETE',3) ... Didn't test this yet though. Link to comment Share on other sites More sharing options...
ZHSoft Posted July 9, 2024 Share Posted July 9, 2024 Yes, this is the right approach, and the backup SQL can be controlled later through commands. This requires patient testing, and each new version needs to be tested. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now