Google Service APIs
When you interract with Google Services such as the Prediction API and Google Cloud Storage on behalf of your application, you need to create a service account, so that your application can provide its own identity. In this case you will need to follow a special workflow for authentification. This article explains how you can do with Paw’s help.
- Discover APIs
- Google Service APIs
Create a service account for your project and generate a key
Create a service account for your project and generate a key
Create a project on Service accounts section then create a key.
Get access token
Get access token
Create a POST request in Paw to https://www.googleapis.com/oauth2/v4/token
. In the Body section pick Form URL-Encoded
and set the parameters.
Set the grant_type
to urn:ietf:params:oauth:grant-type:jwt-bearer
and insert the JSON Web Token for assertion
.
Now you can build your JWT. Click on the inserted dynamic value to set the input. First set the alg
header value to RS256
.
Then set the claims in the Payload section as described in Google documentation (see more tips on how to build your JWT in Paw).
Pick the scope you are requesting the access for from OAuth 2.0 Scopes .
(We are taking https://www.googleapis.com/auth/prediction
as an example)
Paste your private key that you received from Gooogle Developer Console in the Secret field (remember to replace \n
in the key with a new line). Then send your request to get the token.
Make API calls
Make API calls
You can now start testing the Google Service APIs, i.e. Cloud Prediction API. Choose an API in the Overview. Remember to enable the API you’ve chosen.
Choose the endpoint that you want to test: we will make a request to list the trained models for our project.
Create a new request in Paw and give it a name.
Paste https://www.googleapis.com/prediction/v1.6/projects/project/trainedmodels/list
in the URL field and replace the word project
by your project id.
Set the access_token
URL parameter to the token you got in the previous request. You can use the Respone Parsed Body dynamic value to avoid copying and pasting.