Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Overview

...

HostBill User API plugin enables HTTP REST API for your customers to manage their accounts from their apps/systems.  Additionally API is self-documenting , so your users will have nice, comprehensive documentation of all methods that your API offers.


 

Installing module

...


...

Activating the module

...

  1. If the plugin is included in your HostBill edition you can download it from your client portal.
  2. If the plugin is not included in your HostBill edition you can purchase it from our marketplace and then download it from the client area.
  3. Once you download the plugin extract it in the main HostBill directory.
  4. Go to Settings → Modules, find and activate User API plugin.

Module configuration

...

  1. Proceed to Extras → User API - you can manage your API routes from this section
  2. It is important to set URL rewrites for API to function, depending on your web-server software
    1. Apache users
      in /api folder rename file template.htaccess to .htaccess 
    2. Nginx (including HostBill enterprise) users 
      Edit your location file (in server section, for HostBill enterprise it is /etc/nginx/locations/hostbill.conf, add 

      Code Block
      location @userapi {
            rewrite ^/api/(.+)$ /api/index.php?/$1 last;
        }

      Next, to main location add try_files line:

      Code Block
      try_files $uri $uri/ index.php @userapi;



  3. Now, restart your webserver.

Configuring routes

...

You can configure routes (API functions) in Adminarea ->Extras->User → Extras → User API

Using this section, you can:

  • Add route alias - this creates copy of the route, so you can rename it. Ie. For example if you wish to change route from /service to /cloud - create alias for first one.
  • Edit - by editing route you can:
    • Enable/Disable it - you can limit to which functions your customers will have access to (ie if you use IPAM plugin only for admin purposes, you can disable IPAM api functions for clients)
    • Change route name - change how route appears in documentation

    • Change route category - change category where route appears in documentation

    • Change route description - enter your custom description of route to be shown in documentation


FAQ

...

QQuestion: Can we customize client area templates, edit introduction text or add company logo?
AAnswer: Yes, but you will need to edit template files used by this module, located in: ./includes/modules/Other/userapi/user/

QQuestion: I'm missing route/function XYZ, do you plan to add it?
AAnswer: Yes! Just let us know what is missing for you and we're happy to improve this plugin for you.

QQuestion: I'm using Apache + PHP-FPM - I'm always getting wronglogin error, even with right credentials.
AAnswerYour apache is not passing Authorization header to php-fpm. To do that, add to your .htaccess or vhost config file:

...