Example API Call

One you have create the JWT and authenticated with the built-in API call, you'll use the result of the API call to authenticate your request.

This can be done in two ways: placing the access token in the header or placing the access token in a parameter. Both methods are explained below.

Before You Start

  • Download the "API Connector" plugin from Bubble

  • Create a new API with whatever name you like

    • Set the Authentication type to "None or self-handled"

Access Token In A Parameter (Preferred Method)

This method relies on a parameter in the URL called access_token.

The value of the access token is just your access_token generated from the Google API - Request Bearer Token stage.

  • Choose whatever name for the call that you would like.

  • The "Use as" dropdown should be set to "Action" if you would like to use it in a workflow.

  • The "Data type" dropdown should be set to "JSON" for all Google API's

  • Customize the "GET" dropdown and URL for your type of call. You should use the Google Developer Docs to do this. You can usually find them by Google-searching "Google Directory API docs" where "Directory API" is the API you need.

  • If there are no parameters in the URL, add the parameter to the end as shown below.

google-api-url.com/some/directory -> google-api-url.com/some/directory?access_token=[access_token]
  • If there are already parameters in the URL, add the parameter as shown below.

google-api-url.com/some/directory?someParameter=this -> google-api-url.com/some/directory?someParameter=this&access_token=[access_token]
  • Make sure to uncheck the "Private" option. If the parameter is "Private" it cannot be modified in the workflow.

  • Paste a sample response from Google by clicking "Manually enter API response" or by using the demo. website (https://google-service-account-example.bubbleapps.io/) to get an access_token. WE DO NOT STORE ANY DATA GENERATE WITH THE SAMPLE WEBSITE; YOU CAN VERIFY THIS FOR YOURSELF BY VIEWING THE APP.

  • Optional: once initialized and working, clear the "Value" field for the "access_token" parameter to save yourself a step when constructing workflows.

DO NOT INCLUDE THE WORD BEARER IN FRONT OF THE KEY IN THIS METHOD. The Bearer prefix is only used when the authorization is being done in the header.

In the example below, the full URL has been shortened using "..." so the access_token parameter is fully visible.

Access Token In The Header (Alternate Method)

For this alternative, you need to create a header called "Authorization" in the API call and set it's value to "Bearer ya.nklenrlkner..." where the word Bearer is followed by a space and then your access_token generated from the Google API - Request Bearer Token stage.

  • Choose whatever name for the call that you would like.

  • The "Use as" dropdown should be set to "Action" if you would like to use it in a workflow.

  • The "Data type" dropdown should be set to "JSON" for all Google API's

  • Customize the "GET" dropdown and URL for your type of call. You should use the Google Developer Docs to do this. You can usually find them by Google-searching "Google Directory API docs" where "Directory API" is the API you need.

  • Click the "Add header" button to add a header with the Key set to "Authorization" and the Value set to "Bearer ya.jkekjn..." which is "Bearer your-access-token-here".

  • Make sure to uncheck the "Private" option. If "Private" is set, it cannot be modified in the workflow.

  • Paste a sample response from Google by clicking "Manually enter API response" or by using the demo. website (https://google-service-account-example.bubbleapps.io/) to get an access_token. WE DO NOT STORE ANY DATA GENERATE WITH THE SAMPLE WEBSITE; YOU CAN VERIFY THIS FOR YOURSELF BY VIEWING THE APP.

YOU MUST INCLUDE THE WORD BEARER AND A SPACE IN FRONT OF THE KEY IN THIS METHOD.

Last updated