This post is based on testing Google Contacts API functions (not all but few of them) in Postman-Rest-Client tool.
- As u already know, we need to have Google Chrome running in your machine with the Postman extension installed in it.
- You must have a Google Contacts account. Don't worry, if you do have a gmail account, you will be having a Google Contacts account as well. All you need to do is to login to it at least once using the following url.
- Of course, you need to have Contacts in your account to start testing any function given in the api.
- You need to refer the Google Contacts API documentation well before starting to test them. The below link will direct you to the latest version of it.
- The most important thing is you need to obtain an authorization access token from Google Developers' OAuth 2.0 Playground. Follow the below link to obtain it and note i will explain you how to get the access token step by step.
Great. Now, let's go from point zero :)
I assume everyone has a gmail account so that a Google Contacts account too. So, let me explain you how to obtain an access token from Google Developers' OAuth 2.0 playground.
Obtaining an Autherization access token from Google Developers' OAuth 2.0 playground for Google Contacts
1.Go to the link below
Note that the obtained access token expires within the time that is mentioned above so that you have to use that for testing before it expires. But once it's expired, you can refresh and obtain a new access token to continue testing.
So, I hope it's clear up to this level. Next is simply to get a function, identify its parameters etc and test for it's response through postman-Rest client tool.
Before that, we have to confirm the function that we are going to test, don't we? Refer the below link and focus on the function that is highlighted in the below screenshot that is taken from the Google Contacts API documentation page.
Check the below shown screenshot to identify the function correctly.
How to test the Retrieve All contacts function in postman?
Open Postman-Rest-API plugin in your Google Chrome Web Browser and Click Reset button to clear any existing tests that you have been working with. Then set the below values in front of the below shown fields accordingly.
Set the url in the below format:-
https://www.google.com/m8/feeds/contacts/<your email address>/full
Add a Header call Authorization and add the value as shown below (note that your access token shouldn't be expired at the time you are using it to test):-
Bearer <the access token you obtained above>
for an example, refer the below screenshot
If you didn't enter an email in the request url, then the default email will be used which means the account that you have currently logged in.
I hope the post was clear enough for you to start with Postman to test API functions. Hope it was useful to you :) See you in another interesting post ...