Testing the HubSpot APIs

Google's OAuth 2.0 Playground allows you test test any OAuth 2.0 compatible system (including HubSpot). It does most of the management for the OAuth part of the connection, allowing you to focus on the actual APIs.

By default, the OAuth 2.0 Playground is designed to work with Google APIs, but it can be configured to work with HubSpot APIs instead.

The playground allows you to store some of the settings in the URL.  This URL will start you out with HubSpot's authorization and token URLs pre-populated:

You'll see a popup the first time you go to that URL, asking you to confirm the OAuth configuration. Click the green "OK!" button to continue.  You can check the checkbox before clicking the button to prevent that popup from appearing again.

warningwindow.png

After closing that popup, you'll see the configuration window open on the right. You'll need your Client ID and Client secret from a HubSpot app that you've created. If you haven't created an app yet, you can find instructions for doing that here.

oauthsettings.png

Now you'll need to enter the scopes you want to test. You can find a list of the scopes we support here. You'll need to manually enter the scopes into the text box (the selectable scopes will be for Google's APIs), separating each scope you want to request with a single space.

scopesbox.png

After entering your scopes, click the blue Authorize APIs button, then you'll be directed to HubSpot, where you'll see a list of portals that you have access to. Select the portal you want to test with, click the orange "Grant Access" button, and you'll be brought back to the OAuth 2.0 Playground.

Step 2 should automatically be selected, and the authorization code from HubSpot should be populated in the text field. Click the blue button below the code to generate your access and refresh tokens, which will be populated in their respective fields. HubSpot access tokens last for 6 hours; you should see a countdown below the tokens.  You can check the auto-refresh checkbox to have the playground automatically refresh the token before it expires, otherwise you can use the refresh button to manually generate a new token.

tokens.png

Once you have the tokens, Step 3 should automatically open.  At this point, you can enter the URL for a GET endpoint into the Request URI field, and click the blue "Send the request" button to make the API request against the portal you selected to test with.

As an example, if you requested the 'contacts' scope, you could use the Get all contacts endpoint.

requestdetails.png

If you're making a POST or PUT request, you can set the request body using the button between the Request URI field and the blue Send button.