Beeceptor helps you create mock APIs. When a request is received at Beeceptor endpoint, it can be matched against rules. You can define multiple rules. The rules are matched in the given order. The first rule matched is picked to send mocked response. If none of the rules match, default response with
200 OK is sent.
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!)
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.
In the response section you can introduce a delay for the response. The caller will get the response only after the specific seconds.
Note: This is server time and Beeceptor tries to match given seconds. The request may take little longer than specified seconds.