pythonpython-redmine

Python redmine api: journals.filter usage


For example I have an issue:

issue = redmine.issue.get(100)

It is possible to get the notes of particular user for this issue?

I found journals.filter method:

issue.journals.filter()

But I don't know syntax for filter() method.

Can somebody help?

Thanks in advance.

BR, Alex


Solution

  • Redmine API doesn't allow you to do that via direct API calls, so you have to first include journals (otherwise you'll make 2 API calls instead of one) and then iterate over them and check if that record belongs to the needed user, e.g.:

    issue = redmine.issue.get(ISSUE_ID, include='journals')
    
    for record in issue.journals:
        if record.user.id == USER_ID:
            print record.id, record.created_at
            print record.notes
            print record.details