Learn from experts and connect with global tech leaders at POST/CON 24. Register by March 26 to save 30%.

Learn more →
X

Introducing APIs to Access and Manage Server-Level Responses on a Mock Server

Avatar

Server errors make for a poor user experience, so it’s important to handle them correctly. While this is a common scenario, it’s hard to replicate while testing. To help address this, Postman now brings server-level response APIs accessible via the Postman API to you.

A quick overview of server-level responses

Server-level responses are returned by a server when it fails to fulfill a valid request, and these failures are agnostic of application-level logic. Status codes that are returned by servers in such cases include 500, 503, etc. These new APIs now allow you to simulate the same behavior on a mock server, and you don’t need to define 5xx errors individually for all paths exposed on your mock server. If you set one of the server-level responses as active, then all the calls to the mock server will be returned with that active server-level response.

What can you accomplish using these APIs?

Let’s look at how you can replicate the unavailable server scenario using these APIs.

Step 1: Create a server-level response on a mock server.

Create a server level response

Step 2: Set the server-level response as active.

Set server level response as active

Step 3: Make a request to the mock server.

Make a request to the mock server

Want to know more? Check out the Postman Learning Center to dive deeper into setting up a mock server or viewing mock calls using the mock call log UI. We also recommend that you stay tuned to the Postman Public Roadmap for developers because we’re constantly working to make Postman smarter, more aware, and more useful for you.

Try Postman now

What do you think about this feature? Tell us in a comment below. You can also give product feedback through our Community forum and GitHub repository.

Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.