May 22, 2018

What is an 'Active' Response in mocktastic?

How to get mocktastic to return the correct response when hitting any endpoint.

Never heard of Mocktastic before? Well, Mocktastic is a cross platform, downloadable, GUI desktop application, which allows you to easily mock up any REST API without having to write a single line of code. Anybody can create a mock API server, and then share it with their team, so the entire team can use it. Click here to know more!
What is an 'Active' Response in mocktastic?

So we've been getting this question a lot from our users recently, and we realized we hadn't really talked about the 'Active' property of a response before, so here's an explainer.

In mocktastic every API you wish to mock is represented as a server. Each endpoint on your API is represented as an endpoint that is associated with that server. Each possible response from the endpoint (200, 400, 500 etc.), are represented as individual responses which are in turn associated with that endpoint.

Since mocktastic has no way of knowing which response you wish to return when a specific endpoint is hit, (unless you pass in an X-Mocktastic-Return-Status header, that is), you need to tell it which response should be returned by default. You do this by marking that particular response as Active.

At any point in time, an endpoint can have only one Active response, so when you mark any response as Active, all other responses get marked as Inactive.

So how exactly do you mark a response as Active? There are multiple ways of changing the active response.

From the Response Page
  • Open the response page, by clicking on the response in the sidebar. [1]
  • Click the Inactive checkbox. [2]
  • The value will now change to Active. [3]
  • Click the 'Update Response' button to save the change. [4]
  • All other responses associated with that endpoint will be automatically marked as Inactive. [5]
From the Endpoint Page
  • Open the endpoint page, by clicking on the endpoint in the sidebar. [1]
  • In the response list section, locate the response you want to mark active. [2]
  • Click the Active checkbox, next to the response. [3]
  • All other responses associated with that endpoint will be automatically marked as Inactive. [4]
From the Server Page
  • Open the server page, by clicking on the server in the sidebar. [1]
  • In the endpoint list section, locate the endpoint for which you want to set the active response. [2]
  • Click the Active Response dropdown and select the response you wish to mark as active. [3]
  • All other responses associated with that endpoint will be automatically marked as Inactive. [4]

Hope that gives you a good understanding of Active responses. Feel free to write to us if you have any questions!