Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search API currently does not work with sort #257

Open
jamoore5 opened this issue Sep 15, 2023 · 3 comments
Open

Search API currently does not work with sort #257

jamoore5 opened this issue Sep 15, 2023 · 3 comments
Assignees

Comments

@jamoore5
Copy link

jamoore5 commented Sep 15, 2023

Search API currently does not work with sort. The sort options in the request are ignored.

I found this when trying to search on contact with a sort by lastmodifieddate.

body = {
  "sorts": [
      {
        "propertyName": "lastmodifieddate",
        "direction": "ASCENDING"
      }
    ],
  "limit": 100,
}
api_response = api_client.crm.contacts.search_api.do_search(
  body: body
)

api_response.results.map { |r| r.properties['lastmodifieddate'] }

After some debugging in the gem code, I discovered that the sort param is being converted to a string before it is sent to HubSpot

My local fix was to update Hubspot::Crm::Contacts::PublicObjectSearchRequest#openapi_types to have

:'sorts' => :'Array<Object>'

instead of

:'sorts' => :'Array<String>'
@CraftyBeer
Copy link

We've run into this too! Thanks @jamoore5. Hubspot any luck on a long term fix?

@pohl989
Copy link

pohl989 commented Nov 15, 2023

Thanks for sharing @jamoore5! I'm running into this issue as well. @alzheltkovskiy-hubspot any plans for a fix?

@alzheltkovskiy-hubspot
Copy link
Collaborator

Hi everyone. We have identified this issue, and we are going to fix it as soon as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants