(API) Get all Tickets with idoit object id XYZ

Infos:

  • Used Zammad version: 3.4.X
  • Used Zammad installation source: source
  • Operating system: Ubuntu 18.04.4

Expected behavior:

  • Getting every Ticket with assigned i-doit object number xyz

Actual behavior:

  • Output returns 0 Tickets
  • I can get Output with simple Queries

Steps to reproduce the behavior:

I’m via ssh onto my i-doit machine. If i do this:

curl -u user:pw -X POST http://zammadurl/api/v1/tickets/search -d 'query=99003'

I get all relevant Information about the Ticket with Ticket# 99003.

If i want to have all Tickets, where i-doit object id 1669 is assigned, i get nothing

curl -u user:pw -X POST http://zammadurl/api/v1/tickets/search -d 'query=preferences.idoit.object_ids:1669'

Output:

{"tickets":[],"tickets_count":0,"assets":{}}

I can see the assigned i-doit Objects with the ticketnumber query:
[...] "preferences":{"idoit":{"object_ids":["1669"]}} [...]

Sorry I can’t reproduce this.
My guess is that your elasticsearch index is no longer up to date which is required for this.

curl --location --request POST 'http://172.16.16.3/api/v1/tickets/search?query=preferences.idoit.object_ids:31' \ --header 'Authorization: Bearer secret' \ --data-raw ''

In my case idoit object id 31 search results 3 tickets as expected.
Above is generated by my postman - in general I’d suggest to use Token based authentication over user based authentication if you have the choice.

The i-doit Support got a solution for me:

$ zammad run rails r “Setting.set(‘es_url’, ‘http://localhost:9200’)” *#
$ zammad run rake searchindex:rebuild

After that, it worked.

1 Like

Okay so drifted searchindex.