我正在尝试使用 REST API(使用 C#)在 VersionOne 中创建一个计划。根据他们的“创建新资产”页面,我发出了获取 XML 的请求,设置了 2 个属性(TimeboxLength 和 TimeboxGap)并将其发回。响应结束为远程服务器返回错误:(404)未找到。
我尝试在基本 url 和范围级 url 上创建它,而不是快乐。
我的代码如下所示:
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 问题,现在只使用凭证缓存就可以了。谁能指出我做错了什么?
提前致谢。