devopshq / tfs

Microsoft TFS API Python client
https://devopshq.github.io/tfs/
MIT License
111 stars 28 forks source link

how to update workitem #39

Closed asherungar-ceva closed 6 years ago

asherungar-ceva commented 6 years ago

Hi, i keep getting an exception ":"You must pass a valid patch document in the body of the request."

i'm trying to update fields inside workitems this way: my_workitem = client.get_workitem(162887) my_workitem.data['fields']['Microsoft.VSTS.Build.IntegrationBuild'] = "master_20180725.1" client.update_workitem(162887, my_workitem.data)

i guess i'm doing it wrong but i can't figure it out. please help thanks Asher

allburov commented 6 years ago

Could you read https://github.com/devopshq/tfs/blob/master/README.md#update-workitem and try update like my_workitem[yourfield]=value Give feedback after, please

asherungar-ceva commented 6 years ago

yes that worked ! thanks. i don't know where i got lost in the middle because i did read that section earlier :)

i also was able after some trial and error to update via json but the method you proposed was much easier of course. client.update_workitem(id, [{'op': 'add', 'path': '/fields/System.State', 'value': 'Implemented'}])

closing the issue thanks