Python use of Mingle API




  • Avatar
    Rudiger Wolf

    I got something working eventually.

    import httplib
    import urllib
    import base64
    mingle_username = 'user name'
    mingle_password = 'password'
    base64string = base64.encodestring('%s:%s' % (username, password))[:-1]
    authheader = "Basic %s" % base64string
    headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain","Authorization": authheader}
    #What is it that we want to change? Note use the same card property names that are returned via the HTTP GET module.
    params = urllib.urlencode({'card[cp_sprint_number]':'8','card[name]': 'Test Name','card[cp_target_release_number]':'RX','card[cp_sprint_development_complete]':'3'})
    print params
    # Now connect to the webserver and get data updated
    conn = httplib.HTTPConnection("") # ID = 1617.xml and Card number = 634.xml
    conn.request("PUT", "/projects/project/cards/1617.xml", params, headers)
    response = conn.getresponse()
    print response.status, response.reason
    data =
    print data

    Hope this helps someone.

    -Rudiger Wolf

    Comment actions Permalink
  • Avatar
    Xiao Li

    Hi Rudi,

    The param name you specified for filters is wrong, it should be “filters[]”.
    And you should not encode all params.
    If some param value need to be encoded, you should only encode the param value,

    for example:


    Comment actions Permalink
  • Avatar
    Xiao Li

    Hi rnwolf,

    The updated_at is a read-only attribute, so you can’t update it and it would be updated automatically every time you updated the card.

    Comment actions Permalink
  • Avatar
    Rudiger Wolf

    I found that changing method=”PUT” got me past resource you requested does not exist error.

    The says that either a POST or PUT can be used to update content.

    Now I have a problem where the only change that happens when I run the script to update card fields is a new updated_at value.
    <updated_at type="datetime">2008-06-25T11:44:20Z</updated_at>

    But the fields such as name have not actually been updated.

    Any thoughts?
    Thanks Rudi

    Comment actions Permalink
  • Avatar
    Rudiger Wolf


    I am having some problems getting information from Mingle via API for filtered card set. Would you be able to suggest how I can apply filters to the GET query?

    Adding encoded parameters to the URL does not seem to work. I am using Python 2.5 on Windows XP.

    import httplib2
    from urllib import urlencode
    http = httplib2.Http()
    mingle_user = 'user'
    mingle_pass = 'password'
    http.add_credentials(mingle_user, mingle_pass)
    uri = ''
    params = {'filter[]':'[Type][is][story]'}
    url = uri + '&' + urlencode(params)
    print url
    response, content = http.request(url,'GET')
    print response
    print content

    When I add parameters to the url I get a ‘status’: ‘406’ error.
    If I leave off paramters then I get an xml file with a limited list of all cards.

    Please help me get a filtered card set back from Mingle via API.


    Comment actions Permalink

Please sign in to leave a comment.