I am hoping to get some guidance on writing to the HubSpot CRM API.
I am using the following to pull data from HubSpot via Azure Data Factory:
Client ID
Client Secret
Access Token
Refresh Token
My understanding is the access_token expires every 30 minutes but the refresh_token will continue to refresh this. This connection has been working for 7 days now.
Does this refresh token expire? I have seen some places saying that it does not, and seeing it has worked for 7 days I am assuming this will continue to work.
Now when I go to write to the HubSpot API have an issue where my access_token is expired. I would think there is a way to use the refresh_token in the API POST?
Here is an example where I get the expiration response:
import hubspot
from pprint import pprint
from hubspot.crm.deals import BatchInputSimplePublicObjectInputForCreate, ApiException
client = hubspot.Client.create(
access_token="placeholder"
)
batch_input_simple_public_object_input_for_create = BatchInputSimplePublicObjectInputForCreate(inputs=[
{"properties":
{
"dealname":"test"
},
"associations":
[
{"to":
{
"id":"99999999999"},
"types":
[
{
"associationCategory":"HUBSPOT_DEFINED",
"associationTypeId":341
}]}]}])
try:
api_response = client.crm.deals.batch_api.create(batch_input_simple_public_object_input_for_create=batch_input_simple_public_object_input_for_create)
pprint(api_response)
except ApiException as e:
print("Exception when calling batch_api->create: %s\n" % e)
“status”:“error”,“message”:“The OAuth token used to make this call expired 5 day(s) ago.”
Thank you in advance for your help!