...
- If the plugin is included in your HostBill edition you can download it from your client portal.
- 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.
- Once you download the plugin extract it in the main HostBill directory.
- Go to Settings → Modules, find and activate User API plugin.
Module configuration
...
- Proceed to Extras → User API - you can manage your API routes from this sectionAPI where you can:
- Enable/disable logging. Enable only for debug/testing purposes
- Set Rate limit - Number of requests users can make in a period of time, when exceeded new requests will be discarded.
- Select available Authentication methods:
- Basic HTTP Auth - This option enables client to use basic authentication. It requires client login credentials in every api request.
- JSON Web Token Auth - Allows clients to authenticate requests with generated token. Client will need to pass their credentials to /login route to generate required token.
Path to JSON Web Token key - used with JSON Web token auth.
Path to RSA private key file, relative to hostbill installation directory or an absolute path.Code Block title Generating private key in linux ssh-keygen -t rsa -b 4096 -m PEM -f private.key -q -N ""
- It is important to set URL rewrites for API to function, depending on your web-server software
- Apache users
in /api folder rename file template.htaccess to .htaccess Nginx (including HostBill enterprise) users .
If you are using SEO URL rewrites described here, modify block "@seohburl" in /etc/nginx/locations/hostbill.conf to look like:Code Block location @seohburl { rewrite ^/api/(.+)$ /api/index.php?/$1 last; rewrite ^/(.+)$ /index.php?/$1 last; }
If you are not using SEO urls, edit your location file (in server section, for HostBill enterprise it is /etc/nginx/locations/hostbill.conf, addCode Block location @userapi { rewrite ^/api/(.+)$ /api/index.php?/$1 last; }
Next, to main location add try files line:
Code Block try_files $uri $uri/ @userapi;
- Apache users
Now, restart your webserver.
...