14.1: Testing with Postman

Intro to Postman

  1. Open Postman.

  2. Make sure you have a username and password for the ElevenNote app. Use a pre-existing user that is in your local database.

  3. Make sure the .WebApi project is running and go to the home screen.

  4. Copy the URL localhost:XXXXX

  5. Open Postman and find your way to the Postman window:

  6. Paste the URL into the address bar and make sure the Http drop-down is set to POST

  7. Add /token to the URL

  8. In the Body tab, add the same keys as the last request like this:

  9. Check x-www-form-urlencoded.

    token POST

  10. Make sure to check urlencoded!

  11. Click on the Headers tab and check Content Type

    Headers

  12. Important note: If you have altered your login to use a username instead of an email, you'll want to use that username instead:

13. Press Send

14. You should get a response with a token if you log in with the proper username/email and password.

Token

15. Troubleshooting common issues: -You didn't delete the IdentityModels after pasting the Async method in the .Data layer. -You didn't copy and paste the connectionStrings in the MVC project.

16. Save this Postman request, we will come back to it

Notes:

  • Remember Statelessness? The server we just pinged sent back a token. Be sure to talk about this in class.

  • It will quickly forget us for each subsequent request

  • We have to provide a token for all other authenticated requests

  • We'll use this later in part 15

Next, we'll add a NoteController to the WebAPI project.

Last updated