how to pass the following JSON to a C# patch method w or w/o Javascript serializer

前端 未结 1 532
面向向阳花
面向向阳花 2021-01-22 09:26

I am working on a program to access the REST API for Visual Studio Team Services (was Visual Studio Online). I am following https://www.visualstudio.com/integrate/api/wit/work-

相关标签:
1条回答
  • 2021-01-22 10:26

    I usually pass the content strings directly and it works:

    string json = "[{\"op\":\"replace\",\"path\":\"/fields/System.Title\",\"value\":\"Title\"}]";
    

    The string json you generated by JavaScriptSerializer is missing "[" and "]".

    By the way, with the code you provided, if you run GetWorkItem(uri) before UpdateWorkItemStatus(uri, httpContent), UpdateWorkItemStatus() won't run since the app exit after GetWorkItem().

    0 讨论(0)
提交回复
热议问题