APIs & Integrations

dcasso
メンバー

Show list of all active tickets under an owner

解決

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件の承認済みベストアンサー
coldrickjack
解決策
トップ投稿者

Show list of all active tickets under an owner

解決

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 いいね!
4件の返信
coldrickjack
解決策
トップ投稿者

Show list of all active tickets under an owner

解決

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 いいね!
dcasso
メンバー

Show list of all active tickets under an owner

解決

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 いいね!
coldrickjack
トップ投稿者

Show list of all active tickets under an owner

解決

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 いいね!
dcasso
メンバー

Show list of all active tickets under an owner

解決

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

0 いいね!