Fleio backend (and API)

The Fleio API is not yet documented, but you have the Python source code available in path /var/webapps/fleio/project and you can browse the source code to see API parameters.

To see what HTTP requests the Fleio frontend is making to the backend and what JSON responses are returned open your Fleio installation in the Google Chrome browser and use the Chrome Developer Tools feature.

Other browsers have similar developer tools: Firefox or Edge.

Here’s how this looks in Chrome:

../_images/fleio-chrome-dev-tools.png

Django REST framework (DRF) offers a browsable API, where you can see a list of available URLs, list of objects in JSON format and also simulate a few create/update operations.

To enable the DRF browsable API add this line the end of to your /var/webapps/fleio/project/fleio/settings.py file:

REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] += ('rest_framework.renderers.BrowsableAPIRenderer', )

Don’t forget to reload the code in the uwsgi server every time you modify Python source code. Run this command in your server’s console to reload the code:

sudo systemctl reload uwsgi

Make sure you are authenticated as a staff user and you should be able to see a page like this one at URL http://mydomain/backed/staffapi/clients:

../_images/staff-api-client.png

If you’re in a development environment (not a production server) you can also enable debugging from settings.py file to get more information in browser when you’re accessing an invalid URL and in case an error occurs during development:

DEBUG = True

Now you’ll be able to to see the backend API nicely formatted and even perform POST, PUT, and DELETE requests. Note that you need to be authenticated as

Here’s an example of PHP code calling the Fleio API: https://github.com/fleio/fleio-whmcs.

You can also run Django commands from the command line after you activate the Fleio Python virtual environment and move to the Django project directory:

# activate the virtualenv
source /var/webapps/fleio/env/bin/activate
# move to the Django project directory
cd /var/webapps/fleio/project/
# see available commands
django -h
# you can reset a user's password
django changepassword USERNAME_HERE
# or create a superuser (staff user)
django createsuperuser

For more information regarding the Django command line see https://docs.djangoproject.com/en/dev/ref/django-admin/