Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter for fetch tickets #35

Open
codeagencybe opened this issue Jul 11, 2016 · 2 comments
Open

filter for fetch tickets #35

codeagencybe opened this issue Jul 11, 2016 · 2 comments

Comments

@codeagencybe
Copy link

?filter=new_and_my_open";

Any documentation how to expand this filter with a date range and customer/company?
And how to fetch also the timetracking details from the ticket(s) (if any available)?

This looks very interesting to automatically fetch the time tracking from tickets created by company/customer John Doe but only the timetracking from a fix period e.g. 1 June 2016 until 30 June 2016 and pull them into invoicing application.

I need the time tracking with from a certain date range only, because old tickets can be re-opened and could cause double invoicing.
So if I can fetch only records from past month, I'm good to go.

Thanks!

@markthoma
Copy link

markthoma commented Nov 23, 2017

I am also trying to pull something similar, but currently getting 404 error:

import requests
import datetime
import json

api_key = "_xxxx_"
domain = "_xxxx_.com"
password = ""

whoRaised = raw_input("Who raised the ticket(s)? ")
whenRaised = int(raw_input("How many days ago? "))
startDate = datetime.date.today() - datetime.timedelta(days = whenRaised)
print(startDate)
r = requests.get("https://"+ domain +"/api/v2/tickets?query=requester:whoRaised%20AND%20created_at:>startTime", auth = (api_key, password))

if r.status_code == 200:
    print "Request processed successfully, the response is given below" + r.content
else:
    print "Failed to read ticket, errors are displayed below,"
    print(r.status_code)
    response = json.loads(r.content)
    print response["errors"]

@hrishikesh-p
Copy link
Contributor

The query parameter is available as part of the search api 'api/v2/search/tickets' but it does not support requestor filtering.

you can use the filter api to achieve the same result . See modified gist here -> https://gist.github.com/hrishikesh-p/bc63f9b4ff0ae5e7f784d8e01e5a2c0e/revisions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants