0
我試圖通過使用RESTSHARP在HP-ALM上發佈實體。 到目前爲止,我已成功驗證並獲得了一些GET響應。 但是,不知何故,每個POST請求我送,我得到這樣的響應:通過RestSharp POST到ALM:不支持的介質類型
qccore.general錯誤 不支持的媒體類型
這是許多試驗我做了(張貼缺陷)之一。任何想法在這裏是錯誤的?
private RestRequest createPOSTRequest()
{
RestRequest Request = m_client.CreateRequest(m_client.BaseUrl +
"rest/domains/{domain}/projects/{project}/{entity-type}", Method.POST);
Request.AddUrlSegment("domain", m_client.domain);
Request.AddUrlSegment("project", m_client.project);
Request.AddUrlSegment("entity-type", "defects");
Request.AddHeader("Content-Type", "application/xml");
Request.AddHeader("Accept", "application/xml");
Request.RequestFormat = DataFormat.Xml;
m_xmlBody = = @"<?xml version='1.0' encoding='UTF-8'? encoding='UTF-8' standalone='yes'?>"+
"<Entity Type='defect'>"+
"<Fields>" +
"<Field Name='detected-by'>"+
"<Value>sa</Value>"+
"</Field>"+
"<Field Name='creation-time'>"+
"<Value>2010-03-02</Value>"+
"</Field>"+
"<Field Name='severity'>"+
"<Value>2-Medium</Value>"+
"</Field>"+
"<Field Name='name'>"+
"<Value>Defect Entity.</Value>"+
"</Field>"+
"</Fields>"+
"</Entity>";
return Request;
}
謝謝。