我正在尝试使用Valence创建一个组。一切看起来都正确(存在orgunit和group类别),但是我得到一个表示“未找到”的WebException。我的测试程序的输出如下。任何人都可以确认uri和JSON块的文档是否正确,“创建组”功能确实有效吗?
D:\d2lmgmt>Valence.exe function=create_orgunit_groupcategory_group requestor=hidden orgunitid=16800 groupcategoryid=2845
Uri: "/d2l/api/lp/1.0/16800/groupcategories/2845/groups/", method: "POST"
POST input: "{"Name":"grouptest name","Code":"grouptestcode","Description":{"Text":"grouptest text","Html":"grouptest html"}}"
WebException: Not found
答案 0 :(得分:0)
您发送的输入似乎是“RichText”而不是“RichTextInput”,即slightly different structure。
REQUEST:
POST https://valence.desire2learn.com/d2l/api/lp/1.0/7733/groupcategories/1879/groups/?x_b=TwULqrltMXvTE8utuLCN5O&x_a=L2Hd9WvDTcyiyu5n2AEgpg&x_d=NPSqMuaKFhpcE2TWRbvh-wK4I25tGdFPzUzqpolELKk&x_c=IQwjo0WycWje8IrhJuxqMC7U5BWOVVwwMFAZWp3a1ag&x_t=1343942454 HTTP/1.1
Accept-Encoding: gzip,deflate
Accept: application/json
Content-Type: application/json
{
"Name": "Group 1",
"Code": "Group 1 code",
"Description": {
"Content": "Group 1 description",
"Type": "Text"
}
}
响应:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Length: 109
Content-Type: application/json; charset=UTF-8
Expires: -1
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Date: Thu, 02 Aug 2012 21:20:44 GMT
{"GroupId":7744,"Name":"Group 1","Description":{"Text":"Group 1 description","Html":""},"Enrollments":[4062]}