I am trying to create a course in a semester through the api in valence d2l. I keep getting a 404 not found error, both in my program and in the "getting started" application. The call I am making is to /d2l/api/lp/1.0/courses/ using post. I pass the following JSON object along with it:

{
    "Name": "COMM291 - Test A",
    "Code": "C-COMM291",
    "Path": "/enforced/C-COMM291/",
    "CourseTemplateId": 20992,
    "SemesterId": 20993,
    "StartDate": "2013-08-22T19:41:14.0983532Z",
    "EndDate": "2013-08-27T19:41:14.0993532Z",
    "LocaleId": 4105,
    "ForceLocale": false,
    "ShowAddressBook": false
}

I have also tried passing null for the fields that say they accept null values, but no luck. The course template and the semester ID are correct - I have tripled checked that they exist, I am enrolled in them and I am using the correct ID numbers.

有帮助吗?

解决方案 3

I found that part of my problem was with the call if I change it to /d2l/api/lp/1.3/courses/ instead of 1.0 it works, (1.0 will work but it seems that you can only pass null for the semester). The dates were also picky and did prefer milliseconds to only 3 decimal places. Then passing null for LocaleId also helped.

其他提示

Try reducing the precision in your start and end dates to three decimals after the final point (e.g., "2013-08-22T19:41:14.0983532Z" becomes "2013-08-22T19:41:14.098Z").

If your org is configured to automatically enforce, and generate, paths for course offerings, then you should not provide one in your CreateCourseOffering block at all. The following structure works on our test instance: notice the empty string for path (shouldn't be null, but an empty string, I believe):

{ "Name": "Extensibility 104", 
  "Code": "EXT-104", 
  "Path": "", 
  "CourseTemplateId": 8082, 
  "SemesterId": 6984, 
  "StartDate": "2013-09-01T19:41:14.098Z", 
  "EndDate": "2013-12-27T19:41:14.098Z",
  "LocaleId": 1, 
  "ForceLocale": false, 
  "ShowAddressBook": false }

The other thing to note is that if your CreateCourse form doesn't have a form element to provide a Semester ID, then your API call should pass null for that property.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top