Reporting API

SVenkatesan
Colaborador

I have created a report in Hubspot which displays Record ID of custom object and count of notes each record created everyday. Is there any way to get record id and count details through API. 

0 Me gusta
1 Soluciones aceptada
Bortami
Solución
Colaborador líder | Partner nivel Elite
Colaborador líder | Partner nivel Elite

You can add a filter like you did. Once thing to know is that date timestamps are stored as miliseconds, so you'll want to use a filter like {hs_created_by__gt: date}

 

//today's date at midnight outside of query
const now = Date.now();
const today = new Date(now).setHours(0,0,0,0);
// 1721365200000


query MyQuery {
  CRM {
    p_on24_collection {
      items {
        hs_object_id
        associations {
          note_collection__on24_to_note(filter: {hs_created_by__gt: today} {
            total
            items
          }
        }
      }
    }
  }
}

 

Ver la solución en mensaje original publicado

0 Me gusta
3 Respuestas 3
Bortami
Colaborador líder | Partner nivel Elite
Colaborador líder | Partner nivel Elite

Reports are not exposed through the API, only the bare minimum on marketing analytics. 😠

 

You'll have to compile that info from the CRM information in your code. There's not a nice friendly way to make it happen through regular rest calls that I have found.

 

I'd do it by using GraphyQL.

Here's a query using one of my own custom objects:

query MyQuery {
  CRM {
    p_on24_collection {
      items {
        hs_object_id
        associations {
          note_collection__on24_to_note {
            total
          }
        }
      }
    }
  }
}

 

This is what I get back, so it could be parsed to create your own report. Each object in the items array is a custom object record, and the associations.note_collection__on24_to_note.total is the total number of notes on that record.

  "data": {
    "CRM": {
      "p_on24_collection": {
        "items": [
          {
            "hs_object_id": 3403924027,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 0
              }
            }
          },
          {
            "hs_object_id": 3403932706,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 1
              }
            }
          },
          {
            "hs_object_id": 3404103223,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 0
              }
            }
          },
          {
            "hs_object_id": 3404225558,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 0
              }
            }
          },
          {
            "hs_object_id": 3404259885,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 0
              }
            }
          },
          {
            "hs_object_id": 3404273410,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 0
              }
            }
          },
          {
            "hs_object_id": 3404326481,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 2
              }
            }
          },
          {
            "hs_object_id": 3407101570,
            "associations": {
              "note_collection__on24_to_note": {
                "total": 0
              }
            }
          }
        ]
      }
    }
  }

 

0 Me gusta
SVenkatesan
Colaborador

is it possible to filter records to show only the notes created today?
query I have used

query MyQuery {
CRM {
p_25_collection {
items {
hs_object_id
associations {
note_collection__c25_to_note(filter: {hs_createdate__eq: "2024-07-19T00:00:00.00Z"}) {
total
}
}
}
}
}
}


By above query im getting all the records where total is Zero as well

0 Me gusta
Bortami
Solución
Colaborador líder | Partner nivel Elite
Colaborador líder | Partner nivel Elite

You can add a filter like you did. Once thing to know is that date timestamps are stored as miliseconds, so you'll want to use a filter like {hs_created_by__gt: date}

 

//today's date at midnight outside of query
const now = Date.now();
const today = new Date(now).setHours(0,0,0,0);
// 1721365200000


query MyQuery {
  CRM {
    p_on24_collection {
      items {
        hs_object_id
        associations {
          note_collection__on24_to_note(filter: {hs_created_by__gt: today} {
            total
            items
          }
        }
      }
    }
  }
}

 

0 Me gusta