Skip to content

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:

  1. Click the blue Add API button in the upper right corner.
  2. In the dialog that appears, provide the following:
    1. Name of mock API
      Name your API. It will be called Untitled mock API #n if left blank.
    2. Base URL
      The root URL of your mock API will be https://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.
  3. 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:

export TOKEN=<paste-your-token-here>

Now in the dropdown, click Copy base URL.

Then type the following into your Bash terminal:

curl -sX GET -H "Authorization: Bearer $TOKEN" <paste-your-url-here> | jq

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:

{
  "info": "Welcome to the RequestBite mock API called \"<your-api-name-here>\".",
  "endpoints": []
}

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.