Skip to main content

Create Mock Server From OpenAPI Specification

The OpenAPI Specification (OAS) is a language-agnostic specification that describes API definitions. It is widely used by developers at the API design stage. With the OAS’s declarative specification (YAML and JSON), the developer can define API interface without the knowledge of server implementation or access to the server code.

Beeceptor takes your OAS to next level by hosting a mock server with just one click. You can now upload the specification file to an endpoint and start serving requests.

info

This feature is available with paid plans.

Upload OpenAPI Specification

Beeceptor accepts YAML or JSON representation. You can open OAS setup screen by navigating as Account Menu > Your Endpoints > Settings for the selected endpoint.

uploading-oas-in-beeceptor

The following screenshot is an example to upload a specification file. In addition,

  • You can also download already configured specification.
  • You can cleanup any uploaded specification.

uploading-oas-in-beeceptor

Default Matching

The support for OSA is implicit in Beeceptor. Once the specification is uploaded and parsed successfully, Beeceptor tries to match the incoming request path as per the OAS definition. A sample mocked response is returned by default matching the API response's meta definition.

Example: Pet schema

For example, consider a Pets API's OAS as below where the following Pet schema definition is declared for find-all-pets-by-tags API with GET method:

Pet schema definition

Example: Beeceptor Response

When the OAS matcher at Beeceptor matches a GET request on /pet/findByTags endpoint, it returns following mocked response:

Beeceptor response for FindByTags

You can override this response by creating a new mocking rule. A custom mocking rule gets higher precedence over default OAS response.

If you have further questions, feel free to reach out to support.