How to create a great API using Postman

Required steps:

1. Create a request
Read the docs online and create the request
Ensure you add all the url and variables to the environment variables, then use {{var}} to access them

2. First time, create a mock server (can be public or private depending on the info you are giving back)

3. In the request click 'add example' and then add the json which was documented in the online docs so you give back the same thing

4. Create a test
In the test add var jsonData = pm.response.json(); and pm.environment.set('access_token',jsonData.access_token);
This will set the var after it gets it back from the mock server

5. Use the 'code' to get the code

6. build this into your application using the mock server so you can get all the code working

7. when the real backend server is ready simply replace with the real variables url and then retest your code

# 1 > Video how to create mock-servers

When your front end team is ahead of your back-end team, you can create a mock-server so you can test the front end before your back-end is already complete:


Great video: