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).
-
-
In both cases, it is recommended to a create an account.
Sending your first GET request
Expand
Workspaces and click on
+New Workspace. Name it
MyPostmanWorkspace, then click
Create workspace and team.
Click on Go to workspace. Inside your workspace, click on create new collection and name it Twilio.
click on the three dots next to Twilio.
Click on
create a new folder. Name it
SMS.
Expand
SMS and click on
Add a request. Name it
MessageLog
To add a documentation to this new request. Click on the documentation icon on the right hand side next to the comment icon.
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).
Postman supports markdown. The above comment adds a link to twilio list all messages
API.
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.
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.
You'll see that
path variables appear in
params tab. Fill the path variable
TWILIO_ACCOUNT with the value of the variable
{{TWILIO_ACCOUNT}}.
Check the response body which indicates that you need an authentication token to invoke the
API (Status: 401 Unauthorized).
To add authorization, click on
Authorization tab. Select
Inherit auth from parent. Then click
Save.
Click the Twilio collection. Then Authorization. Choose Basic Auth.
Since username and password are secret information, we will use the concept of
variables in Postman. Click the
Variables tab.
We will add two variables: one for the user name and another for the password.
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.
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.
click on Save.
Go back to
Authorization tab. Fill in the username and password with the created variables using double curly braces.
click Save.
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.
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.
Back to top