-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
56 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: HTTP routes | ||
meta: | ||
title: Mockoon HTTP routes documentation | ||
description: All you need to know about Mockoon's mock API HTTP routes creation, behavior, custom body, headers and more. | ||
order: 210 | ||
--- | ||
|
||
# HTTP routes | ||
|
||
--- | ||
|
||
## Overview | ||
|
||
**HTTP routes** are the most basic **endpoints** you can create in Mockoon. They are flexible and can be used to mock any type of API. They support many customizations like [headers](docs:response-configuration/response-headers) and [body](docs:response-configuration/response-body) and can have [multiple responses](docs:route-responses/multiple-responses) and [rules](docs:route-responses/dynamic-rules) to handle different scenarios. | ||
|
||
To create a new HTTP route, click on the "HTTP route" entry in the add route menu: | ||
|
||
![Add a new HTTP route{498x304}](docs-img:add-http-route.png) | ||
|
||
A new route will be created with a default 200 status code and an empty body. You can then customize it to fit your needs. | ||
|
||
![view of a new HTTP route{1484x476}](docs-img:new-http-route.png) | ||
|
||
## Independence and statelessness | ||
|
||
All HTTP routes are **independent** of each other and **stateless**. It means that HTTP routes will **not share any data** with other routes and that the route will **not remember any information** between requests. This is important to keep in mind when creating complex APIs with multiple routes. | ||
|
||
Some exceptions to this rule are: | ||
|
||
- [**Global variables**](docs:variables/global-variables) that can be used to store and share data between routes in the templating engine. | ||
- [**Rules based on the request number**](docs:route-responses/dynamic-rules#1-target) that can be used to answer differently based on the index of the requests. | ||
- [**Data buckets**](docs:data-buckets/overview) that can be used to serve data from a shared source. However, the data bucket cannot be modified by an HTTP route, see below. | ||
|
||
## Relation with data buckets | ||
|
||
HTTP routes can use [**data buckets**](docs:data-buckets/overview) to serve data from a **shared source** and avoid duplication. By selecting ["Data bucket" in the route response body type](docs:response-configuration/response-body#data-bucket), you can choose a data bucket to serve data from for any of your routes. | ||
|
||
However, the **data bucket cannot be modified** by an HTTP route. Example: an HTTP route with a PUT method won't be able to update a data bucket. It ensures that the data bucket remains a shared source of truth and that the HTTP routes remain stateless. | ||
|
||
If you want a data bucket to act as a **simple JSON database** and be **manipulated** by your endpoints, you can create [**CRUD routes**](docs:api-endpoints/crud-routes) that will be able to interact with the data bucket by creating, reading, filtering, updating, and deleting data, in a RESTful way. |
Binary file modified
BIN
+33 Bytes
(100%)
public/images/docs/latest/api-endpoints/folders/routes-nested-folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.02 KB
public/images/docs/latest/api-endpoints/http-routes/add-http-route.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
public/images/docs/latest/api-endpoints/http-routes/new-http-route.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+197 Bytes
(100%)
public/images/docs/latest/callbacks/overview/add-callback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+77 Bytes
(100%)
public/images/docs/latest/data-buckets/overview/add-data-bucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...logging-and-recording/auto-mocking-and-recording/logs-recording-in-progress.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+17 Bytes
(100%)
...atest/mockoon-cloud/templates-and-ai-assistant/ai-assistant-generate-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+20 Bytes
(100%)
...koon-cloud/templates-and-ai-assistant/ai-assistant-generate-endpoint-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.29 KB
(130%)
...oud/templates-and-ai-assistant/ai-assistant-generate-endpoint-create-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...mockoon-cloud/templates-and-ai-assistant/ai-assistant-generate-endpoint-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-11 Bytes
(100%)
...mockoon-cloud/templates-and-ai-assistant/ai-assistant-generate-template-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
...koon-cloud/templates-and-ai-assistant/ai-assistant-template-generate-option.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+75 Bytes
(100%)
...atest/mockoon-cloud/templates-and-ai-assistant/templates-generate-get-route.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+183 Bytes
(100%)
.../latest/mockoon-data-files/data-storage-location/environment-move-to-folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+180 Bytes
(100%)
.../latest/mockoon-data-files/data-storage-location/environment-show-in-folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+217 Bytes
(100%)
...s/latest/mockoon-data-files/environment-clipboard-copy/export-clipboard-env.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-74 Bytes
(99%)
...ages/docs/latest/mockoon-data-files/sharing-mock-api-files/open-environment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+416 Bytes
(100%)
.../docs/latest/response-configuration/file-serving/environment-show-in-folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+75 Bytes
(100%)
...ic/images/docs/latest/response-configuration/response-body/body-data-bucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+91 Bytes
(100%)
...c/images/docs/latest/response-configuration/response-body/body-file-serving.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+59 Bytes
(100%)
...ic/images/docs/latest/response-configuration/response-body/body-type-toggle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+110 Bytes
(100%)
.../images/docs/latest/response-configuration/response-body/inline-body-editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+23 Bytes
(100%)
...ges/docs/latest/route-responses/dynamic-rules/route-response-rules-operator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+28 Bytes
(100%)
public/images/docs/latest/server-configuration/cors/enable-cors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+75 Bytes
(100%)
.../latest/server-configuration/serving-over-tls/enable-tls-custom-certificate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.