When using the example for `Post /crm/v3/objects/deals/search` from the docs at Accounts Dashboard | HubSpot I can test call and get the expected results. However, when pasting into my own code, my response always includes all deals with none of the specified filtering.
I’m using Ruby, but I experimented with the cURL and Python options too. cURL returns the expected response, but the Python option required some edits to the sample code (the import statement was incomplete.)
Therefore, I’m wondering if the docs are generating an incomplete sample code, but running the complete code behind the scenes.
Here’s the code the docs are showing me to use:
require 'hubspot-api-client'
Hubspot.configure do |config|
config.api_key['hapikey'] = 'YOUR_HUBSPOT_API_KEY'
end
public_object_search_request = Hubspot::Crm::Deals::PublicObjectSearchRequest.new(filter_groups: [{"filters":[{"value":"true","propertyName":"ready_to_bill","operator":"EQ"}]}], sorts: ["descending"], properties: [["dealname","ready_to_bill"]], limit: 1, after: 0)
begin
api_response = Hubspot::Crm::Deals::SearchApi.new.do_search(public_object_search_request: public_object_search_request, auth_names: "hapikey")
puts api_response
rescue Hubspot::Crm::Deals::ApiError => e
error_message = JSON.parse(e.response_body)['message']
puts error_message
end
Has anyone experienced this and come up with a fix? Would it be better to open an issue on the code in GitHub? I’m not able to tell if it’s the sample code, or the ruby-api-client that’s the problem.