Create a new enrollment for a user

44 views
Skip to first unread message

Jason Whitener

unread,
Oct 3, 2014, 7:50:33 PM10/3/14
to valenc...@googlegroups.com


I am working with the java client.  

I want to enroll someone in a course.  

As a quick test, I modified the index.jsp by changing the exampleCreateUser() function to this:

function exampleCreateUser() {
showData();
document.getElementById("POSTField").checked = true;
document.getElementById("actionField").value = "/d2l/api/lp/1.0/enrollments/";
document.getElementById("dataField").value = "{\n \"OrgUnitId\": \"12345\",\n \"UserId\": \"12345\",\n \"RoleId\": \"123\" \n}";
}

I get a 404 message.  I next noticed that the document I linked above mentions that enrollment was deprecated in 1.1.  I used 1.0 just because that is what the index.jsp used for the whoami code.  

Long story short, I've tried 1.1, 1.2, 1.3, all return a 404 message.  

What is the proper path to the enrollment API?  

Desire2Learn Staff: Sarah-Beth

unread,
Oct 6, 2014, 9:26:24 AM10/6/14
to valenc...@googlegroups.com
Hi Jason

The path you need is documented in the Valence docs. As you mentioned, the 1.1 and 1.0 versions of the route are now deprecated. Depending on the version of the LE you are running, you should have several newer versions of this route available to you, which will have the same functionality. You can use the API Test Tool to point to your instance and use your App ID\Key pair for the app you're developing to run the GetVersions call to confirm the supported API versions. Then you can also authenticate with the user you're testing with, and attempt this call against your LE. Once you get it working with the API Test Tool, you should have a better idea how to troubleshoot your code to get it working within your app. You might also want to check out the blog post about possible reasons you're receiving a 404 on your calls.

Let us know how it works out for you, and if you have further questions.

~S-BB

Jason Whitener

unread,
Oct 6, 2014, 7:03:02 PM10/6/14
to valenc...@googlegroups.com
It turns out that 404 in this context was referring to a problem with the data, not the URL path.  

Desire2Learn Staff: Sarah-Beth

unread,
Oct 7, 2014, 9:22:49 AM10/7/14
to valenc...@googlegroups.com
Thanks for reporting on the resolution. Glad it's working now.

~S-BB
Reply all
Reply to author
Forward
0 new messages