Mocktainer is a micro service that mocks micro service API's with fake data accross multiple endpoints representing various verticals and functions.
Access http://notno.io/mocktainer to try the free hosted service.
/Root returns help and instructions in HTML format/accountsReturns mock bank accounts in JSON/customersReturns mock customers in JSON/employeesReturns mock employees in JSON/inventoryReturns mock product inventory in JSON/ordersReturns mock orders in JSON/portfolioReturns mock investment portfolio in JSON/prescriptionsReturns mock drug prescriptions list in JSON/tradesReturns mock trades in JSON
Echo URI : Simply add /echo to the end of any endpoint above to echo back
the original request with payload and request headers. Helpful for troublshooting.
Adding New Endpoints : See instructions below.
Methods Supported : GET PUT POST DELETE PATCH
Parameters : ?n=<number> to specify number of records to return. Default is 10. Max is 250.
Successful Response : 200 OK
{
"Results": {
...
}
"Request": {
...
},
}See usage examples for Kubernetes, Kong for Kubernetes Ingress Controller, and docker-compose in the examples directory folder.
If behind an API gateway or reverse proxy, you may wish to have only the URI of the original request
echoed back and not the URI of the upstream proxy target. To do this you may add the docker environment
variable APP_BEHIND_PROXY=TRUE to your configuration or set the global behind_proxyconfiguration
to true in the config/fsl_config.php file.
Docker image is Alpine 3.11 based running PHP 7.3 on Apache. The container exposes both ports 80 an 443 with a self signed certificated. If you wish to alter the container configuration, feel free to use the Dockerfile in this repo (https://github.com/yesinteractive/mocktainer/blob/master/Dockerfile). Otherwise, you can pull the latest image from DockerHub with the following command:
docker pull yesinteractive/mocktainer
Typical basic usage (below example exposes mocktainer on host ports 8100 and 8143):
$ docker run -d \
-p 8100:80 \
-p 8143:443 \
yesinteractive/mocktainer
Typical usage in Dockerfile:
FROM yesinteractive/mocktainer
RUN echo <your commands here>
Adding a new endpoint is as simple as adding a new CSV file in the endpoints directory. The name of the csv will be the dynamic endpoint. The first row must be column header names and there is no limit to the amount of columns. See examples in the controllers directory.
If you have an endpoint to share, please add your submission via a pull request.
