Section Enrollment

48 views
Skip to first unread message

Joseph Price

unread,
Feb 13, 2014, 5:36:51 PM2/13/14
to valenc...@googlegroups.com
Hi Forum... It's me again :)
I'm trying to use this route to create an enrollment in a section

/d2l/api/lp/1.3/73436/sections/73437/enrollments/

With this JSON block

{
"UserId":173197
}

I've verified all of the ID references in the route are valid but I keep getting this JSON response:

{
"Errors":[{"Message":"Resource Not Found"}]
}

Can you see my issue?

I have a fiddler trace if you want it. I can direct mail it if so. I just didn't want to put it out there.

Thank you
- Joe

Desire2Learn Staff: Viktor

unread,
Feb 18, 2014, 11:59:08 AM2/18/14
to valenc...@googlegroups.com
Hmm... Does the user identified with ID 173197 already have an explicit enrollment in the parent course offering for that section? I would suspect, because of the Section.SectionEnrollment properties (and more, the one that isn't there: the RoleId), that your User must already be explicitly enrolled in the parent course offering (org unit 73436), and that the section enrollment call merely makes explicit that user's enrollment in the child section (with the same role from the parent course offering).

If your user doesn't already have an enrollment in the course, then that could explain why you're getting the "Resource Not Found" error -- the call is looking for the user enrollment in the parent and can't find it, maybe?

Also, does your calling user have permission to enroll users with the appropriate role in Group and Section org unit types? I say Group and Section because on many client LMSes, what get called Section org units are actually of the Group org unit type under the covers. You can check the underlying org unit type of 73437, and then make sure that your calling user has permission to enroll users of the appropriate type (173197's role in org unit 73436) into org units of 73437's type...

Hope this helps,

v.

Joseph Price

unread,
Feb 19, 2014, 9:47:01 AM2/19/14
to valenc...@googlegroups.com
Hi Viktor,
Thanks for the reply and the help. I ended up going with a different route. I used this:

POST /d2l/api/lp/1.3/enrollments/

with this JSON:

{
"OrgUnitId":73437,
"UserId":173197,
"RoleId":207
}

and it worked fine. I'm still not sure why exactly the previous route didn't work. There wasn't a previous existing enrollment and the user context I'm using to make the call is a super admin. 

Thanks again!
- Joe

Desire2Learn Staff: Viktor

unread,
Feb 19, 2014, 11:48:56 AM2/19/14
to valenc...@googlegroups.com
Hey Joe,

I don't think the point is "was there already an enrollment in that org unit", I actually think the point might be "was there an enrollment for that user in the parent org unit" because I suspect there would have needed to be one. Can you confirm: the user you were attempting to enroll into the section already DID have an enrollment, with RoleId 207, in the parent course offering?

--
V.

Joseph Price

unread,
Feb 20, 2014, 10:23:59 AM2/20/14
to valenc...@googlegroups.com
Hi Viktor, no the user did not have an enrollment at the section org or its parent course org. The application is creating users, enrolling them at a school level org then enrolling them in sections. At the point where I was attempting to enroll using the first route method the user did not have any enrollments besides the school level.

Desire2Learn Staff: Viktor

unread,
Feb 20, 2014, 11:50:05 AM2/20/14
to valenc...@googlegroups.com
Then I would highly suspect that the right way to do this is either:

1 -- Make sure the student is first enrolled in the course:

(1a) Enroll the student first in the course offering that is the parent of the target section.

(1b) Enroll the student in the appropriate section that's a child of the course offering.


2 -- Enroll the student directly in the section, using the full "enroll in org unit" call -- assign them a role, and identify the section's org unit ID and user's ID, rather than the enroll in section call.


Which of these methods you employ will likely depend on the needs of your organization, and the side-effects of enrolling users in place in your organization. For example, what roles you have set up to do cascading enrollments, whether your sections are set up to be auto-enrolled (i.e. student enrollments in the course are then auto-enrolled in groups or sections), or whether your sections must receive direct explicit enrollments of students, and so forth.
Reply all
Reply to author
Forward
0 new messages