Endpoint

In this article we will look at all the tools that are present in the endpoint functionality.

Path input

Each project has a unique domain, format xxxxxxx-mock.migratech.cloud. When creating an endpoint, you only need to specify a route that starts with /. For example /users, /auth/register. Maximum length - 128.

Search engine

To work with the search engine, you need to use URI segments of the format {id} or {id?} for optional parameters. We reviewed this functionality in detail on the page below:

Search engine

Methods and statuses

The platform supports all the basic methods such as - GET, POST, PUT, DELETE and many response codes.

Body

You can use any text response. For JSON there is an object generator using loops. We'll look at this below. Maximum length - 4_000.

Variables

{
  "message": null,
  "response": [
    {
      "id": "{$randomUuid}",
      "name": "{$randomCreditCardNumber:MasterCard}"
    }
  ]
}

The platform supports dynamic responses based on variables. Variable format {$<variableName>} Some variables support passing arguments. Let's look at some examples.

  • {$randomNumber} - simple variable with no arguments

  • {$randomNumberBetween:12,36} - where : indicates that the arguments will be listed next and , is the separator for each argument.

The full list of variables can be found on the page below:

Variables

Headers

You can create up to 10 headers, in key-value format. For example: key content-type and value application/json

Cookies

You can create up to 10 cookies, in key-value-ttl format. For example: key site_session and value <sometoken> and TTL 1440

Embedded Blocks

You can create your own variables with code blocks that can be embedded in the main body of the response. You can also generate arrays of data using loops. Below you can familiarize yourself with this functionality in more detail.

Embedded Blocks

Webhooks

We can configure the webhook to be executed after each request for the current endpoint. Read more on the page below.

Webhook

Settings

You can delay the response to simulate poor internet or a heavy task. Set time in milliseconds (max 30,000).

Render cache

Take a snapshot of the response body after generating data to "freeze" it for searching or showing a single state. Read more on the page below.

Render cache

Last updated

#20:

Change request updated