Skip to content

Instantly share code, notes, and snippets.

@BrianZanti
Last active July 5, 2023 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrianZanti/15c794a233d3c123b03382519b7e943a to your computer and use it in GitHub Desktop.
Save BrianZanti/15c794a233d3c123b03382519b7e943a to your computer and use it in GitHub Desktop.

Workspaces

  • Everyone should be on the Postman Turing student plan
  • Recommended to have Mock Server start kit docs open in a separate tab
  • Quick Demo of creating Workspaces

Breakout Groups

In your capstone teams:

  1. Create a Workspace for your Capstone Group with Visibility set to “Public” or “Team”
    1. Public will allow you to share with people outside of Turing, such as employers
    2. Team will limit access to your team. Only use this if you are working with sensitive data (unlikely)
  2. Fork the Mock Server starter kit into your Workspace
  3. Double check that everyone on the team can see the starter kit in their workspace

Environments

Breakout Groups

Back in your capstone teams:

  1. Open Mock Server Starter Kit -> RESTful Endpoints -> Sample GET Request
  2. Hover over {{domain}}. You should see an error Unresolved Variable. Your goal is to make this error go away.
  3. Navigate to Environments. Create a new environment, add a variable called domain, and give it a current value (not initial value) of "sandwich" (or any other word you desire). Save your environment.
  4. Navigate back to the Sample GET Request. Select your newly created Environment from the Environment drop down in the top right corner of the Postman app.
  5. You should now see the {{domain}} variable resolves to the value you input in the environment variable.

Mock Servers

Click send on the Sample GET Request. An error occurs because we don't have an actual domain yet. Bummer. We could build out the entire BE that would respond to this request, but that would take time and leave the FE blocked by the BE. Instead, we can use Example Responses to create a Mock Server. A Mock Server is like a fake BE that will respond to requests, but it can only respond with the examples you create. Notice that there is already an Example Response for the Sample GET Request.

Create Mock Server.

Add an example.

Breakout Groups

Back in your capstone teams:

  1. Create a Mock Server from the starter kit
  2. Create an example response for a POST/PUT/PATCH 3. Don't forget to add the x-mock-match-request-body header
  3. Hit your Mock Server endpoints from the broswer and from Postman.

Capstone Team Work Time

Breakout Groups

Back in your capstone teams:

  • Use what you've learned to create a Mock Server for your capstone team
  • Use your JSON contracts to inform what requests/examples you create

Tips

  • Watch out for whitespace in your requests such as returns or spaces. They should will be denoted with icons in Postman, but they are hard to see.
  • You need to click the Save button or do cmd + s on a Mac to save your work. Postman will not autosave for you.
  • You need to use the browser version of Postman to collaborate with teammates
  • Any variables you use in Postman must be spelled exactly correct
  • When using environments, make sure that the correct environment is selected in the top right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment