Enterprise Web API Documentation

What is a stub?

A stub is an item designed to produce a known result without much development effort. It is used to mimic certain components during testing. In this case, Revelio stubs mimic entire services.

Revelio's stub feature serves multiple purposes:

  • Allows developers to code against an endpoint whose interface has been designed, but is not yet implemented. Instead of waiting for the new service, the consuming team can code and test against the published interface.
  • Produces responses that are not easily created in a normal environment like timeouts or server errors. Each consuming team can then verify their code is able to handle these edge cases.
  • Acts as a failover for non-production environments in the event that a service is unavailable. For example, Team X provides an endpoint to verify a user is authenticated, but their development database crashes. While they are repairing their environment, any other teams using this service can create a stub to respond that every user is authenticated. While this is not suitable for a production environment, it allows other teams to continue their work.

Using stubs

With Revelio, you can easily create a stub through the Response panel. Just click "Add to Stub" and modify the response content. The content will default based on the defined response structure, but you can return any string. You can also change the response code to imitate error scenarios.

After defining the content and response code, you can choose to add it to an existing stub site or create a new one. A stub site allows you to group multiple stubs together. You can also choose how to handle requests to endpoints that do not have associated stubs:

  • Pass through — Send the request to the actual site and return the response
  • Redirect — Return a redirect response to the actual site
  • None — Return a 404 "Not Found" response

After the stub is added, a message is displayed with a URL to use as your base URL. For instance, if you add a stub for /user/{userId} to stub site XYZ, it would show "". You can then append /user/{userId} to that URL to return the stub response.

A site can only have one stub per endpoint. Any additional stub will overwrite the existing one.