velaware Posted January 29, 2014 Report Posted January 29, 2014 I made a thread on this elsewhere but since I did a bit of a major overhaul, enough to warrant basically a 2.0 of it. This differs in very, very big ways. The biggest is that this supports ORM now. Instead of manually calling APIs via doing this: from blesta_api import * api = BlestaAPI(...) api.get("ApiKeys", "getList") You can do it this way: from blesta_api import * api = BlestaAPI(...) # Get list of API keys api.models.ApiKeys.getList() # Use my API Helper's test module api.plugins.apihelper.test(str="Returning this string") This makes the code easier and more pleasant to read. It should be noted that both methods are supported, and for ORM to work the API Helper plugin needs to be installed. Otherwise this won't work (Blesta doesn't offer a native way to get all available API calls). All api.models calls are found in /blesta/app/models while api.plugins reads all plugins that have a public model in the /blesta/plugins directory. Source: https://github.com/anzenehansen/Blesta-Goodies/blob/master/api/blesta_api.py API Helper tarball: https://github.com/anzenehansen/Blesta-Goodies/raw/master/apihelper_plugin.tar.gz INSTALL Use as you would any other Python script. The only thing you have to actually import is BlestaAPI, so from blesta_api import BlestaAPI is fine too. TODO Create a way to determine HTTP method for each API call (currently only GET is supported) CHANGE LOG v2.0.0 - 01/28/2014 Initial release danmo and interfasys 2 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.