Hubspot’s docs do a terrible job explaining how to use the Seach API for products. In their example they have filterGroups, filters, value, and values - but no explanations that I can find on what those do/what values should go in them.
import hubspot
from pprint import pprint
from hubspot.crm.products import PublicObjectSearchRequest, ApiException
client = hubspot.Client.create(access_token="YOUR_ACCESS_TOKEN")
public_object_search_request = PublicObjectSearchRequest(filter_groups=[{"filters":[{"value":"string","values":["string"],"propertyName":"string","operator":"EQ"}]}], sorts=["string"], query="string", properties=["string"], limit=0, after=0)
try:
api_response = client.crm.products.search_api.do_search(public_object_search_request=public_object_search_request)
pprint(api_response)
except ApiException as e:
print("Exception when calling search_api->do_search: %s\n" % e)
I assume “value” would be the value you want to search for (like the name of a product), but then what do you put in values? I tried just doing value but got an error “…problem: value and values are mutually exclusive”
import hubspot
from pprint import pprint
from hubspot.crm.products import PublicObjectSearchRequest, ApiException
client = hubspot.Client.create(access_token="YOUR_ACCESS_TOKEN")
public_object_search_request = PublicObjectSearchRequest(filter_groups=[{"filters":[{"value":"E60-82-007-04-01","values":[],"propertyName":"name","operator":"EQ"}]}], sorts=["name"], properties=["id"], limit=0, after=0)
try:
api_response = client.crm.products.search_api.do_search(public_object_search_request=public_object_search_request)
pprint(api_response)
except ApiException as e:
print("Exception when calling search_api->do_search: %s\n" % e)