Searching for a custom org unit

50 views
Skip to first unread message

Joseph Price

unread,
Feb 10, 2014, 10:58:38 AM2/10/14
to valenc...@googlegroups.com
Hi,
We have org units for all of our schools and are hoping to use valence to add students to these org units. From what I'm seeing, in order to do this I'll need to know the D2LID for the org unit I want to add a user to and the only way to do that is to query the LE with valence. I've found this route in the documentation ( found here ):

/d2l/api/lp/1.3/orgstructure/

And you are supposedly able to filter on orgUnitCode, orgUnitName, or orgUnitType. The problem is when I test this ( either from my app or from the valence test site ) I get a "NotFound" or "Unknown error occurred" response. Is my query formatted correctly? I've tried all of the following unsuccessfully :

/d2l/api/lp/1.3/orgstructure/?orgUnitType=school

/d2l/api/lp/1.3/orgstructure/?orgUnitCode=[schoolCode]

/d2l/api/lp/1.3/orgstructure/?orgUnitName=[schoolName]

Thanks,
- Joe

Desire2Learn Staff: Sarah-Beth

unread,
Feb 10, 2014, 11:04:20 AM2/10/14
to valenc...@googlegroups.com
Hi Joe

The route you identified was introduced in version 1.4 of the API (see the API Versions info in the route description you linked to), which was release as part of LMS v10.3. In your examples above, it looks like you're trying to call that route using version 1.3 of the API. To confirm, are you currently running LMS v10.3 or are you still at LMS v10.2?

~S-BB

Joseph Price

unread,
Feb 10, 2014, 11:08:12 AM2/10/14
to valenc...@googlegroups.com
Hi Sarah-Beth,
It appears that we're still on 10.2. Is there any way to get what I'm looking for in 10.2?

Desire2Learn Staff: Sarah-Beth

unread,
Feb 11, 2014, 9:32:41 AM2/11/14
to valenc...@googlegroups.com
We have an API Recipe on the blog that shows how to walk down the org structure and compile a comprehensive list of specific objects in the org. In this case, we were chasing down courses, so we had to dive fairly deep. You should be able to use a similar process to isolate all the School orgunits and then pull their Identifiers from the result set. It's not as efficient as the API introduced in API v1.4 but it's certainly doable.

Joseph Price

unread,
Feb 19, 2014, 9:51:14 AM2/19/14
to valenc...@googlegroups.com
Hi Sarah-Beth,
The recursive pull of orgunits has worked out to be the best solution. I've created a separate app that will run before my main load of user data that will gather the D2L orgId's for any newly created courses & sections. We are keeping the ID's locally so I can query for them anytime I need them. 

Thanks for the help!
- Joe

Desire2Learn Staff: Sarah-Beth

unread,
Feb 19, 2014, 10:43:57 AM2/19/14
to valenc...@googlegroups.com
Thanks Joe - I really appreciate your follow-up to share your approach with the Community.

If anyone else is doing something similar, it'd be great to hear about it here, too.
Reply all
Reply to author
Forward
0 new messages