APIs & Integrations

ayrancd
Member

Get all updated tickets

I'm trying to get all updated tickets (messages) from today using:


https://developers.hubspot.com/docs/methods/tickets/get-all-tickets (I don't see any filter)


or


https://developers.hubspot.com/docs/methods/tickets/get-ticket-changes (it requires timestamp and it's not filtering properly this is the timestamp for today 1569384000) and I do have a ticket that I added a note but it's not showing up you can check the result here http://pinpointpayments.com/wp-content/plugins/elite/routines.php?a=getTickets

0 Upvotes
7 Replies 7
WendyGoh
HubSpot Employee
HubSpot Employee

Get all updated tickets

Hi @ayrancd,

 

I hope all is well with you 😄

 

When looking at this endpoint: Get a log of changes for tickets, the timestamp parameter should be formatted in milliseconds as stated in this documentation here: How should timestamps be formatted for HubSpot's APIs?

 

It looks like the timestamp 1569384000 isn't in UNIX miliseconds and I can confirm this by converting the timestamp here: https://currentmillis.com/ and the timestamp was converted to 19 Jan 1970 (Which is likely why you ain't getting back the ticket that you've added the note)

 

In this case, you just have to add three zeros behind this timestamp 1569384000 so that it's in miliseconds like this: 1569384000000 and using this timestamp in the endpoint.

 

On my end, when testing this out, I was able to see the ticket title test being return. 

 

I hope this helps to clarify things!

0 Upvotes
ayrancd
Member

Get all updated tickets

Wendy,

 

The array doesn't tell me what is the change or change ID but only ticket ID.

 

I want to get all ticket updates from today with all details for example:

 

- Ticket 1 created on Mar, 05 has a new note on Sep, 26
- API should return its note and ticket # on Sep, 26...

 

I also tried https://developers.hubspot.com/docs/methods/tickets/get-all-tickets but I couldn't find a field to filter using start/end date or timestamp, could you please guide me? Thank you!

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Get all updated tickets

HI @ayrancd,

 

The reason why you're seeing multiple changes is because there's a list of changes for the ticket object id 43089088 at different time. You can understand what changes has been make by looking into the changedProperties (This will show the internal value of the contact property. For example, when looking at num_notes that's the internal value for the Number of sales activities property). Learn more about properties and internal value here: Edit properties.

 

Currently, the Get all tickets API doesn't support filtering. That said, you can loop through all tickets and page backward using the hasMore and offset properties. As mentioned by Connor here: Get all Tickets api with filter.

0 Upvotes
ayrancd
Member

Get all updated tickets

It's impossible to go over all tickets every time we need to get an information... This is not the right track to do.. can you imagine if you have millions of tickets? The correct way should be filtering by date. I hope you guys consider and improve that API.

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Get all updated tickets

Hi @ayrancd,

 

Definitely agree with you on this and currently there is an idea here: https://community.hubspot.com/t5/HubSpot-Ideas/Search-contacts-companies-and-deals-by-custom-propert... which if you have not already done so, I'd suggest for you to do an upvote and add any additional feedback on it.  Hopefully this will gather more interest!

0 Upvotes
ayrancd
Member

Get all updated tickets

Hi Wendy,

 

I took a look at that post but I don't see it as a solution for my needs unfortunately.

0 Upvotes
ayrancd
Member

Get all updated tickets

Hi Wendy tk u for replying to me.

 

I just added a note to my ticket test to see the API returns and it's return 3 positions... I'm assuming it should be only one once it's only one note...

 

Could you please clarify why it's returning the result below?

 

Array
(
    [0] => Array
        (
            [timestamp] => 1569512948192
            [changeType] => CHANGED
            [objectId] => 43089088
            [changes] => Array
                (
                    [changedProperties] => Array
                        (
                            [0] => hs_lastmodifieddate
                            [1] => hs_lastactivitydate
                            [2] => last_engagement_date
                        )

                    [newAssociations] => Array
                        (
                        )

                    [removedAssociations] => Array
                        (
                        )

                    [newListMemberships] => Array
                        (
                        )

                    [removedListMemberships] => Array
                        (
                        )

                )

        )

    [1] => Array
        (
            [timestamp] => 1569512949490
            [changeType] => CHANGED
            [objectId] => 43089088
            [changes] => Array
                (
                    [changedProperties] => Array
                        (
                            [0] => hs_lastmodifieddate
                        )

                    [newAssociations] => Array
                        (
                        )

                    [removedAssociations] => Array
                        (
                        )

                    [newListMemberships] => Array
                        (
                        )

                    [removedListMemberships] => Array
                        (
                        )

                )

        )

    [2] => Array
        (
            [timestamp] => 1569512950433
            [changeType] => CHANGED
            [objectId] => 43089088
            [changes] => Array
                (
                    [changedProperties] => Array
                        (
                            [0] => notes_last_updated
                            [1] => hs_lastmodifieddate
                            [2] => num_notes
                        )

                    [newAssociations] => Array
                        (
                        )

                    [removedAssociations] => Array
                        (
                        )

                    [newListMemberships] => Array
                        (
                        )

                    [removedListMemberships] => Array
                        (
                        )

                )

        )

)

 

This is a PHP application and the timestamp isbeing generated using strtotime(date("d F Y")) * 1000;

 

It should be start/end date.. much easier.

0 Upvotes