Get all tickets between date1 and date2 for company with companyId xxx

Hi!

Im working for my company on retrieving all tickets for a given company we work for, and i also have to filter on dates.

What i have in the body-field now is:

{

"filterGroups":\[

    {

    "filters": \[

        {

        "propertyName": "createdate",

        "operator": "LT",

        "value": "2021-05-30T05:48:58.447Z"

        },

        {

        "propertyName": "createdate",

        "operator": "GT",

        "value": "2021-04-30T05:48:58.447Z"

        }

    ]

    }

],

"sorts": \[

  {

    "propertyName": "createdate",

    "direction": "DESCENDING"

  }

],

"after": 0

}

As you see i dont filter on company ID, but im guessing it has something to do with

“associations.company.companyId”.

The url is btw: https://api.hubapi.com/crm/v3/objects/tickets/search?hapikey={{KEY}}

Thanks in advance!

@ABirkeland

If you are looking for a specific company to filter on, you will need to add it to the filter group

as such:

{
 "propertyName": "associations.company",
 "operator": "EQ",
 "value": "companyID"
}

where companyID == the actual id of the company.

Another issue you will want to address is your timestamp. You will need to convert to milliseconds.

Example of a full request:

{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "createdate",
 "operator": "LT",
 "value": "1622347200000"
 },
 {
 "propertyName": "createdate",
 "operator": "GT",
 "value": "1590811200000"
 },
 {
 "propertyName": "associations.company",
 "operator": "EQ",
 "value": "5394153652"
 }
 ]
 }
 ],
 "sorts": [
 {
 "propertyName": "createdate",
 "direction": "DESCENDING"
 }
 ],
 "after": 0
}