1
votes

I'm successfully creating a new user using the valence API, setting the password and enrolling the new user into appropriate OUs. (I've used the API reference at: http://docs.valence.desire2learn.com/reference.html) I'm logged on using an account created for the application accessing the REST API.

I also want to set some of the profile fields for the new user; I think I need to use the put profile function: PUT /d2l/api/lp/(D2LVERSION: version)/profile/(D2LID: profileId)

My issue is how to find the profile id for the user i've just created. It isn't returned in the user data for the created user and I can't see the API call which would let me retrieve the profile id of the newly created user.

Can anyone point me in the right direction?

Cheers

Alan

1

1 Answers

1
votes

After creating a user you will have its user ID. If you make the following call (documentation)

GET /d2l/api/lp/(D2LVERSION: version)/enrollments/orgUnits/(D2LID: orgUnitId)/users/

You will get a list of all users enrolled in the provided org unit. Note that the result set of this call is paged (see the docs.) Each entry in the result is a Enrollment.OrgUnitUser, which contains a property "user" with a User.User value - which contains the users profile identifier.

You can skip ahead to the user you want by setting the bookmark value to the users userID. See the note in the green box in the documentation for the call for more information.

You can always use the root org for the orgUnitID parameter.