Create Mock Server and Manage Routes
Beeceptor is a powerful mock server that enables you to create mock APIs without any coding. It offers a seamless no-code solution, allowing you to quickly and easily create a sub-domain dedicated as your API endpoint.
When a request is sent to this Beeceptor endpoint, it is automatically matched against rules that you can easily configure. These rules are evaluated and the first matching rule is used to generate a mocked response. In the event that none of the defined rules match for the incoming request, a default response with a 200 OK
status code is sent. With Beeceptor, you can effortlessly create and test your API integrations with confidence, knowing that your mock server is seamlessly simulating your desired behavior.
Creating a mocking rule
You can create mocking rules using Mocking Rules link on the endpoint's dashboard page. Creating a rule is a two step processing. The following screen shot gives an overview about creating a rule.
Matching a request
A request is matched against the HTTP method and a matching criteria. The matching criteria can be any of the following cases from the incoming request.
- Request path exactly matches given text
- Request path starts with given text
- Request path contains given text
- Request body contains some text (available with paid plans only!)
- Request path matches a regular expression (available with paid plans only!)
When a request is received at the Beeceptor endpoint, the incoming request is matched against the mocking rules. The first rule that is matched, wins, and its mock response is sent to the caller. The priority of these rules can be changed by dragging them up or down in the list.
Sending mocked response
The second section in the create rule form defines what to send when a this rule is matched. You can define following things in this section.
- Response HTTP status - a valid HTTP status code. Should be between 200-599.
- Response headers - you can specify multiple response headers in JSON format.
- Response body - this will be the response content.
.
Introducing delay
In the response section you can introduce a delay for the response. The caller will get the response only after the specific seconds.
Beeceptor computes this at server and attempts to match the specified seconds. It's important to note that requests may take slightly longer than the exact time specified. This is due to a variety of factors, such as network latency, server load, etc.