Hi
I am having some problems updating a card with the Mingle API. Getting card information out of Mingle API is working. Any suggestions on how I can update card info via API?
This is python code to update that is not working:
import httplib2
import urllib
http = httplib2.Http()
mingle_user = 'user name'
mingle_pass = 'password'
http.add_credentials(mingle_user, mingle_pass)
data = {'card[name]': 'Some_new_name'}
body = urllib.urlencode(data)
print body # card%5Bname%5D=Some_new_name
#note that database id=1617 for card #634
response, content = http.request('http://10.40.30.23:8080/projects/project/cards/1617.xml', method="POST", body=body)
print response
print content
The error I get is Either the resource you requested does not exist or you do not have access rights to that resource
I do have rights, I think, as I able to get info from Mingle via the following code.
import httplib2
from module_xml import xml2obj
http = httplib2.Http()
mingle_user = 'user name'
mingle_pass = 'password'
http.add_credentials(mingle_user, mingle_pass)
response, content = http.request('http://10.40.30.23:8080/projects/project/cards/634.xml')
print response
print content
mingle_card = xml2obj(content) #function to converts XML data into native Python object
print mingle_card.id # <id type="integer">1617</id>
Any Suggestions?
RegardsRudi
Comments
5 comments
I got something working eventually.
Hope this helps someone.
-Rudiger Wolf
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:
filters[]=[Type][is][#{urlencode('xxx&xx')}]
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.
I found that changing method=”PUT” got me past resource you requested does not exist error.
The http://studios.thoughtworks.com/mingle/2.0.1/help/mingle_api.html 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
Hi
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.
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.
Thanks
Rudi
Please sign in to leave a comment.