У меня есть ответ JSON, который отформатирован как:
{
"list": {
"historySteps": [
{
"actualUserDisplayName": "John Doe",
"actualUserID": "SiteOwner",
"invokerType": "USER",
"step": 10,
"timestampFormatted": "09/23/2019 12:37:04 PM",
"transitionName": "Work",
"userDisplayName": "John Doe",
"userID": "SiteOwner"
},
{
"actualUserDisplayName": "John Doe",
"actualUserID": "SiteOwner",
"comments": "Zebra",
"invokerType": "USER",
"step": 9,
"timestampFormatted": "09/23/2019 11:12:30 AM",
"transitionName": "Return",
"userDisplayName": "John Doe",
"userID": "SiteOwner"
},
{
"actualUserDisplayName": "John Doe",
"actualUserID": "SiteOwner",
"invokerType": "USER",
"step": 1,
"timestampFormatted": "09/23/2019 10:11:48 AM",
"transitionName": "Initiate",
"userDisplayName": "John Doe",
"userID": "SiteOwner"
}
]
}
}
У меня есть код C # как:
public historyList GetWorkFlowHistory(string workspaceId, string dmsId)
{
try {
var client = new RestClient(TenantUrl + $"/api/rest/v1/workspaces/{workspaceId}/items/{dmsId}/workflows/history");
client.Proxy = Proxy;
var request = new RestRequest(Method.GET);
request.AddCookie("customer", CustomerToken);
request.AddCookie("JSESSIONID", SessionId);
request.AddHeader("cache-control", "no-cache");
IRestResponse response = client.Execute(request);
if (response.ErrorException != null)
throw response.ErrorException;
else if (response.StatusCode != HttpStatusCode.OK)
throw new Exception(response.Content);
var results = SimpleJson.SimpleJson.DeserializeObject<historyList>(response.Content);
return results;
}
catch (Exception ex)
{
Log.WriteLog("Exception in GetWorkFlowHistory() - " + ex.Message);
}
return null;
}
[XmlRoot(ElementName = "historySteps")]
public class HistorySteps
{
[XmlElement(ElementName = "actualUserDisplayName")]
public string ActualUserDisplayName { get; set; }
[XmlElement(ElementName = "actualUserID")]
public string ActualUserID { get; set; }
[XmlElement(ElementName = "comments")]
public string Comments { get; set; }
[XmlElement(ElementName = "invokerType")]
public string InvokerType { get; set; }
[XmlElement(ElementName = "step")]
public string Step { get; set; }
[XmlElement(ElementName = "timestampFormatted")]
public string TimestampFormatted { get; set; }
[XmlElement(ElementName = "transitionName")]
public string TransitionName { get; set; }
[XmlElement(ElementName = "userDisplayName")]
public string UserDisplayName { get; set; }
[XmlElement(ElementName = "userID")]
public string UserID { get; set; }
}
[XmlRoot(ElementName = "list")]
public class historyList
{
[XmlElement(ElementName = "historySteps")]
public HistorySteps HistorySteps { get; set; }
}
Код работает до точки ответа.извлекает контентЯ не могу понять, что я делаю неправильно, когда я пытаюсь DeserializeObject.Возвращает historySteps = null.Чего мне не хватает?Я правильно выбрал подход?