These API utils simplify making requests to some of HubSpot's public API endpoints.
To use these API utils, you need to:
- Have a HubSpot configuration file, populated with valid account information
- Parse and store the configuration file in memory using the available config file utils
Once those steps are complete, you can make requests with these utils. The HTTP wrapper will handle all of the authentication requirements, such as formatting the header and token refreshes.
This library also includes utils that handle request errors. Check out the Error Handling Docs for more information on how they can be used.
Here's how to use the addSecret
API util:
const { loadConfig } = require('@hubspot/local-dev-lib/config');
const { addSecret } = require('@hubspot/local-dev-lib/api/secrets');
// Parse and store the config file information
loadConfig();
const accountId = 12345;
await addSecret(accountId, 'my-secret-name', 'my-secret-value');