Configuring Google Drive API through REST Client in Astera
Last updated
Last updated
© Copyright 2023, Astera Software
Astera has an in-built REST service using which you can retrieve data residing on online sources such as Google drive. In this document, we will cover the REST API configuration required to call data from Google drive.
Create a new project on https://console.developers.google.com/apis.
On the Dashboard window, click Enable APIs and Services and add Google Drive API.
Now select Google Drive API from the Project Dashboard and click on Try in API Explorer.
On the API Explorer window, turn on Authorize requests using the OAuth 2.0 option. At this step, you will be required to sign in to your Google Drive account. Log in by providing your username and password and click Allow.
Now go back to the Project Dashboard and click Credentials in the menu bar on the left. Click on the Create credentials drop-down button and select OAuth Client ID from the drop-down list. Now, in the context menu, select Web Application and in the Authorized Redirect URLs field, type: https://developers.google.com/oauthplayground.
Copy your Client ID and Secret Key. You will need these in the next steps.
Now go to https://developers.google.com/oauthplayground. Click on OAuth 2.0 Configuration and check the Use your own OAuth credentials checkbox.
Enter the OAuth client ID and Client Secret Key (created in the previous step) in the OAuth Client ID and OAuth Client secret fields respectively.
Now type https://www.googleapis.com/auth/drive in Input Scope and click Authorize. Click Allow on the next screen.
On the OAuth 2.0 Playground Step 2 tab, click Exchange authorization code for tokens to generate the OAuth access token.
Now open the Astera client and configure the Rest Client with the following settings:
Create the layout in Astera using sample JSON text to retrieve data from Google Drive.
The token for the REST client is generated outside Astera, that is, on the source platform you want to retrieve the data from. Once generated, this token can be used for multiple subsequent REST calls and you’ll be able to get the result as long as the token is not expired.
However, the token can also expire for different reasons. It can be that the time duration is breached or because it hasn’t been in use for the required time frame.
Astera does not offer any such maintenance as to withhold this token expiry. This is outside the scope of the application and the expiry setting of the token is maintained and controlled by the online source platform itself.