I am trying to post an entity on HP-ALM, by using RESTSHARP. So far, I successfully authenticated and got some GET responses fine. But, somehow, for each POST request I send, I get this response:
qccore.general-error Unsupported Media Type
This is one of the many trials I made (for posting a defect). Any ideas for what is wrong here?
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;
}
Thank you.
No comments:
Post a Comment