Mock API is a tool that allows you to easily and quickly create REST API(s), or in other words, mock the API, without the need for technical knowledge or software development.
You can instantly create an API with default CRUD operations via API Documentation and open it to users as an API Proxy.
Another important point is; Thanks to the conditions added to the response, Apinizer provides different responses depending on the condition, based on the header, body or parameter values of the request.
The API definition documents of the created Mock APIs, of type Swagger and OpenAPI, can be accessed on the fly in JSON and YAML format.
Creating a Mock API
The Development → API Creator → Mock API path is followed through the main menu.
Click the Create button at the top right of the interface that opens.
The API creation work begins by filling in the fields below for the newly created API and clicking the Save and Next button at the top right
Creating Mock API with Blank Type
Creating this type of API means that API endpoints will be designed by the user.
If the Generate CRUD Operations option is enabled, GET, POST, PUT, DELETE enpoints will be added to the API automatically.
The image containing the blank type API creation settings is given below:
Generating Mock API from Open API or Swagger
Creating this type of API means that the API will be created through the API Spec File.
The type of API document to be imported or linked should be Swagger or Open API.
The image containing the API creation settings in Import Spec type is given below:
The fields used for the definition of the Mock API are shown in the table below.
It is the creating type of the Mock API. It is done by uploading Blank and Spec file.
|It is the name given to the API by the user. This name appears in interfaces.|
It is the optional definition of the API.
|Generate CRUD Operations||It is selected if it is desired to create ready-made methods/endpoints in GET, POST, PUT and DELETE types for Mock API.|
API Spec Type
Type information of the spec file to be loaded.
Supported types: OpenAPI 3.0.x, Swagger 2.x
Type information of the API spec file to be loaded.
|URL||The address of the API spec file to load.|
Creating a Endpoint
If the Generate CRUD Operations option is selected, the method/endpoints of GET, POST, PUT, DELETE types will be ready by default. A new method/endpoint is added by clicking the Add button as follows.
Filling the fields on the Method/Endpoint definition screen, click the Save button.
Adding or Editing a Response
The responses of the method/point are managed in the Response Information section.
When adding or updating a new response, the following window will open.
The fields used for the Add/Edit a Response configuration are shown in the table below.
HTTP status code information.
Response Content Type
It is the response content type that will return as a response.
|It is the definition information of the method/endpoint.|
It is used to define under which condition the defined response will be returned.
HTTP Headers information is entered.
The body of the response to the user is written.
Creating API Proxy from Mock API
An API Proxy is created for the Mock API by clicking the Create API Proxy button.
To create API Proxy from Mock API, there must be at least one method/endpoint.
API Proxy is created by entering the required fields for API Proxy on the screen and clicking the Save button.
What can be done after this step is exactly the same as the API Proxy document. Click to go to the details.
To view and manage API Proxies in Mock API, click the Manage API Proxies link, and they are viewed and managed from the window that opens.
In the window that opens, Deploy/Undeploy and Redeploy API Proxies created with Mock API are done in this section. Revisions, Deploying, Redeploying, Undeploying
To deploy the API Proxy, click on the Manage API Proxies link and click on the deploy icon.
Confirmation is required after the above process. The information about the installation process is created and the Deploy button is clicked.
When a new endpoint is added to the Mock API or changes are made in the Mock API, all API Proxies created from this API must be redeployed in order for the change to take effect.
When you add a new Method/Endpoint or update an existing Method/Endpoint the following information will appear.
By clicking Reload, the changes are applied to the API Proxies.
Confirmation is required after the above process. Click the Redeploy button after creating the information about the reinstallation process.
From the Mock API page, click on the name of the API Proxy to go to API Proxy.
Similarly, to go to the Mock API page from the API Proxy page, click on the Mock API name in the API Proxy as follows.
Deleting Mock API
When a Mock API is deleted, all API Proxies that depend on it are deleted first by Undeploy and then deleted.