APIs & Integrations

OYakymenko
Member

CRM objects filtering

SOLVE

Hello!  I have a small question regarding the CRM objects API.

 

Is it possible to filter CRM objects by the `updatedAt` and `deletedAt` fields, like the CMS items?

0 Upvotes
1 Accepted solution
ChehakWadhdwa
Solution
Member | Diamond Partner
Member | Diamond Partner

CRM objects filtering

SOLVE

Hey @OYakymenko

 

Yes you can try hitting the below code and check the results.

Hope this helps you out

 

This is an example of searching deals ->

 

searchdeals();

  function searchContact()

  {

    var options = { method: 'POST',

      url: 'https://api.hubapi.com/crm/v3/objects/deals/search?hapikey='+HUB_API_KEY,

      headers: 

       { 

         'Content-Type': 'application/json' },

        body: {

        "filterGroups":[

          {

            "filters":[

            {

                "propertyName": "hs_lastmodifieddate",

                "operator": "EQ",

                "value":property_value

              }

            ]

          }

        ]

      },

      json: true };

    

     request(options, function (error, response, body) {

      

       if(response.statusCode==200){

                                 //deal found now do what you want

         console.log(response.body);

                }

       else

         {

           console.log('no contact found');

         }

     });

  }





Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

View solution in original post

0 Upvotes
2 Replies 2
ChehakWadhdwa
Solution
Member | Diamond Partner
Member | Diamond Partner

CRM objects filtering

SOLVE

Hey @OYakymenko

 

Yes you can try hitting the below code and check the results.

Hope this helps you out

 

This is an example of searching deals ->

 

searchdeals();

  function searchContact()

  {

    var options = { method: 'POST',

      url: 'https://api.hubapi.com/crm/v3/objects/deals/search?hapikey='+HUB_API_KEY,

      headers: 

       { 

         'Content-Type': 'application/json' },

        body: {

        "filterGroups":[

          {

            "filters":[

            {

                "propertyName": "hs_lastmodifieddate",

                "operator": "EQ",

                "value":property_value

              }

            ]

          }

        ]

      },

      json: true };

    

     request(options, function (error, response, body) {

      

       if(response.statusCode==200){

                                 //deal found now do what you want

         console.log(response.body);

                }

       else

         {

           console.log('no contact found');

         }

     });

  }





Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

0 Upvotes
OYakymenko
Member

CRM objects filtering

SOLVE

Thanks! It looks like this is what I was looking for.

0 Upvotes