Mock APIs
This is documentation for the Mock APIs admin page in RequestBite.
Add new mock API
To add a new mock API, do like this:
- Click the blue Add API button in the upper right corner.
- In the dialog that appears, provide the following:
- Name of mock API
Name your API. It will be called Untitled mock API #n if left blank. - Base URL
The root URL of your mock API will behttps://mock.requestbite.com
. If you append a base URL to your API, you can add it here. Common examples could be/api
or/api/v1
. Leave empty if you don't want a base URL.
- Name of mock API
- Click Create.
You now have an (empty) API and if you click ⋯ in the Actions column next to your API , you will see a dropdown with a number of actions you can perform, such as copying the base URL and the required bearer token to your clipboard and downloading a OpenAPI definition.
Test your mock API
You can now test your new API like so:
In the ⋯ dropdown, click Copy bearer token.
Then type the following in your Bash terminal:
Now in the ⋯ dropdown, click Copy base URL.
Then type the following into your Bash terminal:
jq
is used to format the response. You can safely remove | jq
from the
command above if you don't have it installed.
When you hit Enter
, you should have a response like this:
This means your mock API is up and running. Now you're ready to add some endpoints.
Download OpenAPI definition
RequestBite supports generating an OpenAPI 3.1 definition file for your API.
OpenAPI is a format describing REST APIs, and the resulting file can e.g. be imported into API clients such as Postman so you can quickly start using your mock API, or they can be used with various tools to create source code stubs. An extensive list of tools that support OpenAPI can be found here.
You can visualize and test your generated OpenAPI definition in e.g. the Swagger Editor.
To download your OpenAPI definition, click ⋯ and select Download OpenAPI.
A file called <your-api-name>.yaml
will now be downloaded to your computer.