APIs & Integrations

dcasso
Membre

Show list of all active tickets under an owner

Résolue

Hi

 

I am puzzled as to how to see all active tickets under a given owner.

 

I was trying the following

https://api.hubapi.com/crm/v3/owner/{ownerid}/associations/tickets

but that doesn't work, and also that would give me closed tickets as well (if it had worked).

 

Also can see any references on the relationship diagram:

https://developers.hubspot.com/docs/api/crm/understanding-the-crm?_ga=2.208910994.1839937018.1602061...

 

Can someone point me in the right direction.

 

Thanks

Dennis

1 Solution acceptée
coldrickjack
Solution
Contributeur de premier rang

Show list of all active tickets under an owner

Résolue

Hey @dcasso,

 

The Search API should do what you need here. See an example of how you could structure the request, in my case I'm just using the default ticket pipeline with predefined stages. In any case you can get specifics for the pipeline by using the Pipelines API to pull the stage IDs. Owner IDs can be retreived using Owner API.

 

Screenshot 2022-09-30 at 09.18.55.png

It's essentially the API equivalent to creating a filter when viewing the tickets within the portal itself. Response looks like this:

 

{
    "total": 1,
    "results": [
        {
            "id": "883851720",
            "properties": {
                "content": null,
                "createdate": "2022-09-30T08:09:31.543Z",
                "hs_lastmodifieddate": "2022-09-30T08:09:39.011Z",
                "hs_object_id": "883851720",
                "hs_pipeline": "0",
                "hs_pipeline_stage": "3",
                "hs_ticket_category": null,
                "hs_ticket_priority": null,
                "subject": "Ticket 3"
            },
            "createdAt": "2022-09-30T08:09:31.543Z",
            "updatedAt": "2022-09-30T08:09:39.011Z",
            "archived": false
        }
    ]
}

Voir la solution dans l'envoi d'origine

0 Votes
4 Réponses
coldrickjack
Solution
Contributeur de premier rang

Show list of all active tickets under an owner

Résolue

Hey @dcasso,

 

The Search API should do what you need here. See an example of how you could structure the request, in my case I'm just using the default ticket pipeline with predefined stages. In any case you can get specifics for the pipeline by using the Pipelines API to pull the stage IDs. Owner IDs can be retreived using Owner API.

 

Screenshot 2022-09-30 at 09.18.55.png

It's essentially the API equivalent to creating a filter when viewing the tickets within the portal itself. Response looks like this:

 

{
    "total": 1,
    "results": [
        {
            "id": "883851720",
            "properties": {
                "content": null,
                "createdate": "2022-09-30T08:09:31.543Z",
                "hs_lastmodifieddate": "2022-09-30T08:09:39.011Z",
                "hs_object_id": "883851720",
                "hs_pipeline": "0",
                "hs_pipeline_stage": "3",
                "hs_ticket_category": null,
                "hs_ticket_priority": null,
                "subject": "Ticket 3"
            },
            "createdAt": "2022-09-30T08:09:31.543Z",
            "updatedAt": "2022-09-30T08:09:39.011Z",
            "archived": false
        }
    ]
}
0 Votes
dcasso
Membre

Show list of all active tickets under an owner

Résolue

Hi Jack

 

It works as a charm.

 

I did look into the search endpoint earlier, but since I couldn't find any owner id reference, I gave up on that path.

How did you know that it was called hubspot_owner_id, is there some documentation on those fields.

 

And thanks for your help 🙂

 

Dennis

0 Votes
coldrickjack
Contributeur de premier rang

Show list of all active tickets under an owner

Résolue

Glad to hear! What I normally do is I jump into the portal settings and look at the properties for the object I'm looking to reference. Each property has an internal name which you can also check from within there to use with your request:

 

Screenshot 2022-09-30 at 09.30.28.png

0 Votes
dcasso
Membre

Show list of all active tickets under an owner

Résolue

Thanks again, didn't know that. Makes it a lot easier 🙂

0 Votes