Installation - mkdf/api-factory GitHub Wiki
The API Factory requires the following software and has been tested with the versions stated in parentheses.
- MongoDB (4.2.6)
- Apache (2.4.37)
- PHP (7.2.11)
- Composer (1.10.1)
- MongoDB extension for PHP (1.7.4)
Ensure you have a MongoDB instance installed and running, with a new empty database ready for use with the API Factory and a user account with privileges for creating, modifying and deleting collections, users and roles within that database.
MongoDB installation instructions are available here.
MongoDB instructions for enabling authentication and creating an admin user.
Clone the api-factory repository into a folder within your web server's document tree:
git clone https://github.com/mkdf/api-factory.git <folder_name>
Within the api-factory installation folder, install dependencies using composer:
cd <folder_name>
composer install
Edit config.php
with your MongoDB host, port and database name
<?php
return [
'mongodb' => [
'host' => 'localhost',
'port' => '27017',
'database' => '<database_name>',
],
];
Configure the web-based Swagger API tools. Locate the following section toward the bottom of the following two files:
- swagger-api-factory.json
- management/swagger-api-factory-management.json
"servers": [
{
"url": "https://<yourdomain>/<installation folder>/"
}
],
The url should be updated to reflect the location of your API Factory installation. Note that the API Factory can be installed at the root of your web domain if you wish.
You should also update any references to information URLs and contact email addresses in the two JSON files:
"termsOfService": "<your URL>",
"contact": {
"email": "<your email>"
},
You should configure your web server to only allow requests to the API Factory (both the data stream API and management API) via SSL. The API Factory can operate in an unsecure environment but should only be allowed to do so on a private and secure network. Since username and password authentication is done using HTTP Basic Auth, all production use of the API Factory should happen via HTTPS.