Search code examples
pythondjangoapidjango-viewsactivecollab

Adding assignees to tickets via API call


I'm working with an API to integrate with the ActiveCollab system. I'm trying to add some assignees to a ticket that I have created everytime a new project is created. It is completely ignoring my request to add assignees, which makes me believe that I'm not doing it right.

Here is the link to the API instructions and I've posted a code snippet of my code as well below.

ActiveCollab API Tickets

My code:

#set up the first original ticket in ac
        params2 = urllib.urlencode({
               'submitted':'submitted',
               'ticket[name]': '%s %s estimate to be complete by %s' % (project.pre_quote, project.quote, project.due_date),
               'ticket[created_by_id]': request.user.id,
               'ticket[assignees][0]': project.estimator_id,
        })
        req3 = urllib2.Request("http://url/public/api.php?path_info=/projects/%s/tickets/add&token=#########" % project.API_id, params2)
        f2 = urllib2.urlopen(req3)

Any help would be much appreciated.

Thanks,

Steve


Solution

  • Here is the answer, if anyone runs into the same problem.

    'ticket[assignees][0][]': project.estimator_id
    'ticket[assignees][0][]': another assignee ID
    'ticket[assignees][0][]': and another assignee ID
    'ticket[assignees][0][]': ...
    'ticket[assignees][1]': project.estimator_id