Introducing an API to Access Mock Server Call Logs
We live in a data-driven world where all kinds of decisions, big or small, are made with data in mind. To help enrich you with useful data so that you can make even better decisions, Postman has released the call logs API, which is accessible via the Postman API.
What information does the call logs API provide?
Call logs contain the request and the response data that is exchanged during requests made to mock servers. Let’s have a look at the low-level information you can now expect to get from this API:
- Request-level information: path, method, headers, and body that is sent to the mock server.
- Response-level information: status code, headers, body, and the type of response returned by the mock server.
- Name of the example response used to fulfill the request.
- Timestamp at which the request was served by the mock server.
You can check out the complete documentation of the API here.
What can you accomplish using this API?
Call logs enable you to quickly observe how your mock servers are being used. This data can be used for debugging, testing, analysis, and much more based on your use case.
Let’s have a look at a couple of real-life scenarios where you can use the call logs API.
Scenario: Write tests to validate the content being sent to mock servers.
Step 1. Make a request to the mock server.
Step 2: Make a request to the call logs API to obtain the data that was sent to the mock server.
Step 3: Perform assertions on the data returned by the call logs API.
Scenario: Observe traffic patterns on different routes for static APIs hosted on a Postman mock server.
Step 1. Make a request to the call logs API to obtain the data of the requests made to the mock server.
Step 2. Feed the data into any business intelligence (BI) tool.
Step 3. Draw inferences that you want with the data, in our case, traffic pattern.
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.
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.