- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a mock server in Postman?
We can create a Mock Server in Postman. A Mock Server is used to simulate the working of an actual server to test APIs and Responses. These are very common if certain APIs require to be tested but they are presently unavailable on the web servers due to security concerns on the real server.
The steps to create a Mock Server are listed below -
Step 1 − Click on New from the top of the Postman application. Then click on the Mock Server link.
Step 2 − Choose the option GET from the Method field, add a Request Path as /user/home, enter 200 in the Response Code field and the text- This is Postman Tutori in Tutorialspoint in the Response Body. Finally, click on the Next button.
Step 3 − Provide a Mock Server name, then click on Create Mock Server.
Step 4 − A Mock Server is generated having a Mock URL. Also, the button Copy Mock URL is provided to copy the Mock link. Click on Close.
Step 5 − Choose the option Mock Server as the Environment from the right upper corner of the screen. Then click on Send. In the below image, we find that the Response code is 200 OK and body is - This is Postman Tutorial in Tutorialspoint(which is the same as the Response Body we sent in Step2).
Step 6 − The value of variable url can be obtained by clicking on the eye icon available to the right upper corner of the Postman application.
Thus the request Mock URL is https://05303abe-b842-4c47-ab8c-db2af9334f57.mock.pstmn.io/user/home. This is because of the format {{url}}/user/home we have added at the end of the variable url in the Request Path field in Step2.
- Related Articles
- How to get the response in different format in Mock Server using Postman?
- How to create a Global Variable in Postman?
- How to create a PUT request in Postman?
- How to create a DELETE request in Postman?
- How to create a POST request in Postman?
- How to create sessions in Postman?
- How to create and save a collection in Postman?
- How to Create an Environment in Postman?
- How to set a global variable in Postman?
- How to Import Collection in Postman?
- How to Monitor Collections in Postman?
- How to use Sessions in Postman?
- How to Manage Cookies in Postman?
- How to Add Cookies in Postman?
- How to parameterize requests in Postman?
