14.1: Testing with Postman
Last updated
Last updated
Open Postman.
Make sure you have a username and password for the ElevenNote app. Use a pre-existing user that is in your local database.
Make sure the .WebApi project is running and go to the home screen.
Copy the URL localhost:XXXXX
Open Postman and find your way to the Postman window:
Paste the URL into the address bar and make sure the Http drop-down is set to POST
Add /token to the URL
In the Body tab, add the same keys as the last request like this:
Check x-www-form-urlencoded.
Make sure to check urlencoded!
Click on the Headers tab and check Content Type
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.
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
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.