blazedd Posted May 23, 2017 Report Posted May 23, 2017 It looks like a fairly undocumented change in Blesta 4 includes a change in how plugins extend the API by their url. If you look at the docs here, it shows per 4.0: https://docs.blesta.com/display/dev/Extending+the+API You would make a request to: https://yourdomain.com/installpath/api/foo_bar.foo_bar_sprocket/create.json?vars[price]=1.99 Now you make a request to: https://yourdomain.com/installpath/api/foo_bar.FooBarSprocket/create.json?vars[price]=1.99 It appears that you now reference the class name, rather than the file name. Is there a way that docs can be updated to reflect these changes? Quote
barryf Posted September 29, 2017 Report Posted September 29, 2017 This is pretty major. I cannot find any reference to this in the changelogs. This necessitates a lot of work to change all of our libs. Quote
Paul Posted September 29, 2017 Report Posted September 29, 2017 4.0 was a major release, which included an upgrade to the framework minPHP, PHP 7 support, and a lot more. Major releases can have backwards incompatible changes. Any custom extensions should be tested with a major release in a dev environment before deploying live. activa and Michael 2 Quote
timnboys Posted September 29, 2017 Report Posted September 29, 2017 which is why you need a dev license you can get free from @Paul Quote
barryf Posted September 29, 2017 Report Posted September 29, 2017 Haha, thanks. It was on a Dev instance. We use a central API for controlling all Blesta instances, so need to be able to support both 3.6 and 4.x during the upgrade. Tyson has been kind enough to provide a temporary workaround. Quote
Paul Posted September 29, 2017 Report Posted September 29, 2017 I'm adding Tyson's solution to this thread in case it comes up for anyone else. Nobody should do this unless they rely on snake_case and are having the same issue as @barryf CamelCase should be used going forward. Quote The use of snake case plugin API actions may be supported in the future, but are not currently. It's recommended to use CamelCase. You can apply the below temporary fix to work-around the issue for now: Open and update /app/controllers/api.php from your Blesta installation Find the following line: $this->model = Loader::toCamelCase($this->get[0]); Replace that line with the following: $this->model = ''; $fields = explode('.', $this->get[0]); foreach ($fields as $i => $field) { $this->model .= Loader::toCamelCase($field) . (isset($fields[$i+1]) ? '.' : ''); } Save the file. Your snake_case plugin API actions will now work. activa and Blesta Addons 2 Quote
barryf Posted September 29, 2017 Report Posted September 29, 2017 I can confirm this works. Thanks again Tyson and Paul. Paul and activa 1 1 Quote
JaxSite Posted December 4, 2017 Report Posted December 4, 2017 Paul, We would like to get a dev license to test our existing customizations before upgrading to 4.x. Further, we have a module we would like to start developing as well. Please let us know how we can acquire a dev license to work locally. Thank you. Regards, Jonathan Griffin | JaxSite Quote
timnboys Posted December 6, 2017 Report Posted December 6, 2017 On 12/4/2017 at 1:00 AM, JaxSite said: Paul, We would like to get a dev license to test our existing customizations before upgrading to 4.x. Further, we have a module we would like to start developing as well. Please let us know how we can acquire a dev license to work locally. Thank you. Regards, Jonathan Griffin | JaxSite would have been better to have contacted @Paul on his livechat. Quote
Paul Posted December 6, 2017 Report Posted December 6, 2017 @JaxSite Please open a ticket with us or email sales@ and I can help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.