我尝试使用REST API(使用C#)在VersionOne中创建计划。根据他们的'#34;创建新资产"页面,我发出了获取XML的请求,设置了2个属性(TimeboxLength和TimeboxGap)并将其发回。响应最终为远程服务器返回错误:(404)Not Found。
我尝试在基本网址和范围级网址上创建它,而不是欢乐。
我的代码如下所示:
request = WebRequest.Create(string.Format("{0}/rest-1.v1/Data/",url)) as HttpWebRequest;
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
request.Method = "POST";
request.ContentType="application/xml";
using (StreamWriter rs = new StreamWriter(request.GetRequestStream()))
{
//This string is the populated xml skeleton retrieved from the website
string schedule = string.Concat("<?xml version='1.0' encoding=\"UTF-8\"?>",
"<Asset href=\"/WUP/rest-1.v1/New/Schedule\">",
" <Attribute name=\"TimeboxLength\" act=\"set\">42 Days</Attribute>",
" <Attribute name=\"TimeboxGap\" act=\"set\">2 Days</Attribute>",
"</Asset>");
rs.Write(schedule);
rs.Flush();
rs.Close();
}
try
{
response = request.GetResponse() as HttpWebResponse;
}
catch (WebException we)
{
System.Diagnostics.Debug.WriteLine(we.Status.ToString());
}
我不认为这是一个oauth问题,只是使用凭证缓存现在正在运作。 谁能指出我做错了什么?
提前致谢。