How to call Google cloud APIs in Postman

Reza Rahmati
3 min readDec 21, 2020
Google Cloud API + Postamn

It happened that in your google search you get to one of Google cloud APIs and you wanted to try the API in postman, but Authentication was an issue.
In this article we show how easily you can call Google cloud APIs in Postman.

For this training we try to call Google Natural Language API but the same approach applies for all APIs.

Here is the link for Google Natural Language API

Create the OAuth 2.0 Client

  • For Application type, select Web Application
  • Choose a name like “Postman”
  • Click Add URI in Authorized redirect URIs section and add https://oauth.pstmn.io/v1/callback
  • Click on Create
  • When OAuth Client is created you will see a dialog including your Client ID and Client Secret, copy those values we will need it later

Authorize Postman via OAuth 2.0 Client

  • In Postman, click on plus button to create a new tab
  • Then in Authorization tab, open Type drop down and select OAuth 2.0
  • In Token Name enter Google Token
  • For Grant Type choose Authorization Code
  • Check Authorize using browser
  • In Auth URL enter https://accounts.google.com/o/oauth2/auth
  • In Access Token URL enter https://oauth2.googleapis.com/token
  • Enter your Client ID and Client Secret that you copied before
  • Find the Scope in that specific google cloud api and enter in Scope, in our case https://www.googleapis.com/auth/cloud-platform
  • Your configuration should look like this
  • Click on Get New Access Token
  • You should see this on Postman
  • And your browser will be open to choose the account and authenticate
  • After successful authentication you will get a popup to open postman

If you don’t get the above message, check on top right of your browser, and Allow Popup

  • Click on Open Postman
  • You should see this on Postman
  • Then click on Use Token

Calling the Google Cloud Api

Now you can proceed and call the Google Cloud Api.

In our case a POST request to https://language.googleapis.com/v1/documents:annotateText

and we use the below as body

{
"document": {
"type": "PLAIN_TEXT",
"language": "en-US",
"content": "It happened that in your google search you get to one of Google cloud APIs and you wanted to try the API in postman"
},
"features": {
"extractSyntax": true,
"extractEntities": true,
"extractDocumentSentiment": true,
"extractEntitySentiment": true,
"classifyText": true
},
"encodingType": "UTF8"
}

and here is the results

--

--