API Show Tickes from a View

Infos:

  • Used Zammad version: 3.4.x
  • Used Zammad installation source: package
  • Operating system: CentOS
  • Browser + version: All

Expected behavior:

Get a JSON with only relevant Data from a view like:

tickets id, tickets number, title, assigned user, state, sort_by, prio, etc…

Is there another way to only get ticketid,ticketnumber,title,prio,assign user from a view ?

Actual behavior:

We need to get all Tickets from a Specified View
if we call:

curl -H “Authorization: Token token=xyz” “https://my.zammad.com/api/v1/ticket_overviews?view=prio_tickets” | json_pp

We get a huge JSON with to much information like:

{
“index” : {
“count” : 36,
“tickets” : [ … more nested json …
],
“overview” : { … more nested json …
}
},
“assets” : {
“Role” : { … more nested json …
},
“Ticket” : { … more nested json …
},
“Overview” : { … more nested json …
},
“Organization” : { … more nested json …
},
“TicketState” : { … more nested json …
},
“Group” : { … more nested json …
},
“User” : { … more nested json …
}
}
}

The Problem is that this is Data is too much, speciality the “User” part is way to big as all Users from the Organisation are listet here, and I don’t think that this is necessary in this API call.

We have an json call around 1MB, sometimes even more… this is a problem in low Bandwidth areas.

Steps to reproduce the behavior:

Make a curl in a overview with some ticket in there like this:
(where prio_tickets is sone view, you also can use all_unassigned or something else)

curl -H “Authorization: Token token=xyz” “https://my.zammad.com/api/v1/ticket_overviews?view=prio_tickets” | json_pp

Questions

Is there another way to only get ticketid,ticketnumber,title,prio,assign user from a view ?

Hey @jann,

you could use tickets/search?query=. That way you only get the tickets depending on your query with all their information. After that just parse through the JSON output and you should be fine.

https://docs.zammad.org/en/latest/api/intro.html

You won’t get around working with JSON but that shouldn’t be a problem because it’s pretty easy to handle.

cheers

@dvnkln

But there is no: /api/v1/tickets/search?query=view:all_unassigned

I can make a search query that represents the “all_unassigned” view, but this is static, if an Agent makes some changes in this view or add another view we always need to update our API calls.

What we do:

  1. Get the views: /api/v1/ticket_overviews
  2. List The Tickets in selected view from 1) : eg: /api/v1/ticket_overviews?view=all_unassigned

So there is no other way to get the Tickets from a specified view?

Kinda rubbish “solution” to that would be to do the following:

  1. ticket_overviews? to get the overview conditions
  2. search? to search with the conditions you got via your first call

Run step 1 f. e. only once a day automatically and step 2 any time you need to.
That totally depends on your use-case though. At least you wouldn’t need to perform the “big” call that often.

Can’t think of anything else, sorry. Maybe anyone else can help.

There’s no other endpoint that provides an overviews content.
The reason the API returns “so much rubbish” is simply the reason how the UI works.

Zammads tries to create only the requests that are required. We provide all information needed for the ticket initially. This is the reason why the UI is so fast in most regards.

There’s no workaround.
Either reduce the requests or use a custom script that requests your API and filters out unwanted information if that’s an option.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.