APIs & Integrations

LRIFFELGROEHS
Member

Filtering id greater than

Hello,

everytime I try a POST requisition to the v3 search endpoint using this payload I get an error.

 

{
    "filterGroups": [
        {
            "filters": [
                {
                    "propertyName": "id",
                    "operator": "GT",
                    "value": 4409651
                }
            ]
        }
    ],
    "sorts": [
        {
            "propertyName": "id",
            "direction": "ASCENDING"
        }
    ],
    "properties": list_of_properties,
    "limit": 100
}
0 Upvotes
1 Reply 1
Jaycee_Lewis
Community Manager
Community Manager

Filtering id greater than

Hey, @LRIFFELGROEHS 👋 Thanks for posting! In the future, posting your full request, response, and error body will help the community better understand your issue. 

 

To clarify, you are:

  • Using this endpoint? POST/crm/v3/objects/deals/search
  • Your goal is to search for deals by using their deal ID? Essentially, “show me all deals with a Deal ID > 4409651”, correct? 
  • The internal value for Record ID (Deal ID) is “hs_object_id”
    CleanShot 2023-01-25 at 16.48.51.png

 

Here's a quick test based on what I think you're trying to accomplish.

  • The goal as I understand it — search for Deal with Deal IDs > than a specific value.
  • My request and JSON body:
    POST/crm/v3/objects/deals/search
    
    {
        "filterGroups":[
          {
            "filters":[
              {
                "propertyName": "hs_object_id",
                "operator": "GT",
                "value": "9344774700"
              }
            ]
          }
        ],
        "sorts": [
          {
            "propertyName": "hs_object_id",
            "direction": "ASCENDING"
          }
        ]
      }​

    Please note, in my example, I used a value for the filter that works for my portal.

  • Response
    {
        "total": 14,
        "results": [
            {
                "id": "9435654818",
                "properties": {
                    "amount": null,
                    "closedate": "2022-08-26T17:28:05.450Z",
                    "createdate": "2022-07-08T17:28:15.576Z",
                    "dealname": "Test2",
                    "dealstage": "appointmentscheduled",
                    "hs_lastmodifieddate": "2022-10-24T19:58:04.003Z",
                    "hs_object_id": "9435654818",
                    "pipeline": "default"
                },
                "createdAt": "2022-07-08T17:28:15.576Z",
                "updatedAt": "2022-10-24T19:58:04.003Z",
                "archived": false
            },
    ...
  • By using the GT operator, I excluded one existing deal, as it has a Record ID lower than the value I used. My query returned 14 deals, but I have 15 total deals in my portal. 

In summary, you just needed to use the internal value for this property when searching. There are also a few formatting issues, including missing quotes for some of your values. Easy fixes, though 🙌

 

Have fun building! — Jaycee

 

 





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes