Skip to main content
Solved

Get all tickets for specific ForId using API

  • January 9, 2026
  • 2 replies
  • 35 views

Forum|alt.badge.img

I’m looking for a filter to use in a POST to /tickets that allows me to return all tickets based on the “ForId” in the ticket. I know I can do this by returning all tickets and then filtering the list in my tool, but we’re approaching 70k tickets which would be hundreds of pages and an almost 400mb JSON file returned each time, so I was hoping for a more efficient method using a filter in the body.

 

I’m building an automation that randomly selects a subset of users from a very large list of users and creates a ticket with them as the “On Behalf Of” (ForId in API speak). I’m randomizing and limiting so that I don’t overload my techs with hundreds of tickets at once. Once the ticket is complete, there are mechanisms to remove them from the list getting randomized for future batches.

 

I want to be able to create another batch of tickets before the first batch is necessarily 100% complete, so I’m wanting to see if the specific user already has this specific ticket created for them and then filter them from the list if the ticket already exists. This will prevent duplicate tickets if they happen to be randomly chosen a second (or third) time.

Best answer by JHolloway 6579424 mckinneyisd

Answered my own question with some trial-and-error to better understand how the API works. May be obvious to those more experienced working with APIs, but in case someone finds this later:

{
  "ProductId": "{{ticketing_product_id}}",
    "Schema": "All",
    "Filters": [ { "Facet": "for", "Id": "5d10ffc7-7c78-4c6e-b8d9-4eced9aa4978" }]
}


Facet seems to be the top level keys sent in a response. You can view the example responses to see the available facets, or pull up an individual example ticket by ID to see what’s available.

Cheers.

2 replies

Forum|alt.badge.img

Answered my own question with some trial-and-error to better understand how the API works. May be obvious to those more experienced working with APIs, but in case someone finds this later:

{
  "ProductId": "{{ticketing_product_id}}",
    "Schema": "All",
    "Filters": [ { "Facet": "for", "Id": "5d10ffc7-7c78-4c6e-b8d9-4eced9aa4978" }]
}


Facet seems to be the top level keys sent in a response. You can view the example responses to see the available facets, or pull up an individual example ticket by ID to see what’s available.

Cheers.


scopous_iiq
  • Employee
  • January 12, 2026

Answered my own question with some trial-and-error to better understand how the API works. May be obvious to those more experienced working with APIs, but in case someone finds this later:

{
  "ProductId": "{{ticketing_product_id}}",
    "Schema": "All",
    "Filters": [ { "Facet": "for", "Id": "5d10ffc7-7c78-4c6e-b8d9-4eced9aa4978" }]
}


Facet seems to be the top level keys sent in a response. You can view the example responses to see the available facets, or pull up an individual example ticket by ID to see what’s available.

Cheers.

You are correct that Facet filter is the correct way to filter here.  The correct facet to use would be the “user” facet, which represents the ForId GUID in the ticket.  Here are some related facets just as an FYI.

  - user — Ticket requester (ForId)                  
  - submittedby — Who submitted the ticket                         
  - onbehalfof — Who it was submitted on behalf of                             
  - agent — Assigned technician                  
                                                                                                                                                                      
  All of these accept a UserId GUID in the Id field.