Billing prg in python using rest api

Hi,

This is a humble user speaking. :slightly_smiling_face:
Suppose I want to run a query over the rest api that gives me a list of tickets that had interactions over the last month. What query can I use?

I can use that result to get to the tickets and ticket_articles and merge it into a nice invoice.
Big chunks I have already done for other applications.
If you like I can publish the final product.

Kind regards.
Jeroen Baten
p.s. did I already mention what a great product Zammad is?

Heya,

sure thing - searching is quite easy:
https://docs.zammad.org/en/latest/api-ticket.html#search

You can also use more complex queries, don’t forget quoting and stuff. If you aren’t sure, a pro tip is to cheat and take a look into your network tab on browser developer console, it will contain the payload it sends when you’re searching for specific stuff.
In Addition to this, the following user-Documentation part should be important as well: https://user-docs.zammad.org/en/latest/advanced/search.html

Now to the articles:
Just do that by Ticket and you’ll be fine :slight_smile:
https://docs.zammad.org/en/latest/api-ticket-article.html#by-ticket

Bests
Marcel

Excellent! Thanks for all this information! Really helpful.

1 Like

As a reference for others 2 examples:
In Zammad search: article.created_at:[2019-05-01 TO 2019-06-20]
In curl: curl -H “Authorization: Token token=sometoken” “http://server:3003/api/v1/search?query=article.created_at%3A[2019-05-01+TO+2019-06-20]”| jq .

1 Like

For some reason the url
ticket_articles/by_ticket/"+str(id)+"?sort_by=created_at"
does not return any time_units although mentioned in the documentation (even with : expand=true)

Seems duplicate of this: Rest API Call for Time accounting

That’s correct, seems to be wrong on the documentation - sorry about that.
This should play into this issue: