Table of Contents

First API GET request with Postman

Prerequisites

You can download and install Postman on your computer or use the web version (does not require any installation).

  1. to download and install: Go to https://learning.postman.com/docs/getting-started/installation-and-updates/. Choose your operating system and follow the steps to download and install
  2. To use the web version: Go to https://www.postman.com/downloads/ and click on Launch Postman. Then sign up for an account.
  3. In both cases, it is recommended to a create an account.

Sending your first GET request

  1. Expand Workspaces and click on +New Workspace. Name it MyPostmanWorkspace, then click Create workspace and team.


  2. Click on Go to workspace. Inside your workspace, click on create new collection and name it Twilio.
  3. click on the three dots next to Twilio.


  4. Click on create a new folder. Name it SMS.


  5. Expand SMS and click on Add a request. Name it MessageLog


  6. To add a documentation to this new request. Click on the documentation icon on the right hand side next to the comment icon.


  7. Add the following comment: All messages sent from my account. [Twilio documentation](https://www.twilio.com/docs/sms/api/message-resource?code-sample=code-read-list-all-messages&code-language=Java&code-sdk-version=8.x).
  8. Postman supports markdown. The above comment adds a link to twilio list all messages API.
  9. To invoke the API, copy the following link in the GET field: https://api.twilio.com/2010-04-01/Accounts/{{TWILIO_ACCOUNT_SID}}/Messages.json. Click Send.


  10. Alternatively, instead of using the variable {{TWILIO_ACCOUNT_SID}}, you can use path variables which are preceded by a colon :. Enter the following link https://api.twilio.com/2010-04-01/Accounts/:TWILIO_ACCOUNT_SID/Messages.json. Notice the path variable :TWILIO_ACCOUNT_SID.
  11. You'll see that path variables appear in params tab. Fill the path variable TWILIO_ACCOUNT with the value of the variable {{TWILIO_ACCOUNT}}.


  12. Check the response body which indicates that you need an authentication token to invoke the API (Status: 401 Unauthorized).
  13. To add authorization, click on Authorization tab. Select Inherit auth from parent. Then click Save.


  14. Click the Twilio collection. Then Authorization. Choose Basic Auth.
  15. Since username and password are secret information, we will use the concept of variables in Postman. Click the Variables tab.


  16. We will add two variables: one for the user name and another for the password.
  17. Add a variable named TWILIO_ACCOUNT_SID. The initial value is what others can see. Fill it with your account SID. Fill the actual value with your Twilio account SID.
  18. Similarly, add a second variable named TWILIO_AUTH_TOKEN. Fill the initial value with your Auth token. Fill the actual value with your twilio Auth token.


  19. click on Save.
  20. Go back to Authorization tab. Fill in the username and password with the created variables using double curly braces.


  21. click Save.
  22. Click on Message Log request and resend the Get request. You should get the list of all messages you've sent in the Body Response.
  23. You've made your first API request from Postman. Congratulations! Let's go to the next tutorial to see how to invoke a GET request with parameters.