Small notes. Couldn't figure out hubspot API....

This commit is contained in:
Norm Rasmussen
2023-07-31 17:10:06 -04:00
parent af7edafd35
commit 86678363f9
5 changed files with 46 additions and 16 deletions

View File

@ -18,14 +18,17 @@ def get_groups(apiKey):
nextlink = data["links"]
for response in data["data"]:
group_id = response["id"]
group_name = response["attributes"]["name"]
# print(group_name)
groups_dict = {
"id": group_id,
"name": group_name,
}
groups.append(groups_dict)
created_at = response["attributes"]["created_at"]
if created_at.startswith("2023"):
group_id = response["id"]
group_name = response["attributes"]["name"]
# print(group_name)
groups_dict = {
"id": group_id,
"name": group_name,
"created_at": created_at,
}
groups.append(groups_dict)
if "next" not in nextlink:
break

View File

@ -11,13 +11,32 @@ def no_client():
"Authorization": "Bearer pat-na1-9f41f073-95e2-4eea-b0c9-3e9571a3998c",
}
# url = "https://api.hubapi.com/crm/v3/objects/companies?limit=10&archived=false"
# url = "https://api.hubapi.com/crm/v3/objects/notes?limit=100&archived=false&properties=hubspot_owner_id,hs_note_body"
# url = "https://api.hubapi.com/crm/v3/objects/notes/search?limit=100&archived=false&properties=hubspot_owner_id,hs_note_body"
url = "https://api.hubapi.com/crm/v3/objects/notes/search"
# url = f"https://api.hubapi.com/crm/v4/objects/companies/{COMPANYID}/associations/notes"
url = f"https://api.hubapi.com/engagements/v1/engagements/" # 36317682030"
# url = f"https://api.hubapi.com/engagements/v1/engagements/" # 36317682030"
# associated/COMPANY/{COMPANYID}"
response = requests.get(url, headers=headers)
data = {
"filterGroups": [
{
"filters": [
{
"propertyName": "hs_attachment_ids",
"operator": "NEQ",
# "value": "5951571334",
"value": "136317682030"
}
]
}
],
"properties": ["hs_note_body"],
}
response = requests.post(url, json=data, headers=headers)
# print(response)
jsontext = response.json()
jsontext = json.dumps(jsontext)
print(jsontext)
# for item in jsontext['results']:
# for props in item['properties']: