Users Enrollment Create

Hello,

Could someone help me out with an API question?

I'm having trouble posting to the Users Enrollment Create endpoint and wonder if someone from this forum could look at what i'm passing over and provide some guidence.

I am succesffully creating a user object, applying the address, & applying the phone.

This is the data i'm pushing to the ,

{
"user_id": 0,
"grade_level_id": 0,
"school_level_id": 0,
"school_year_label": "string",
"enroll_date": "string",
"depart_date": "string",
"current_year": true,
"has_grades": true,
"grade_repeated": true,
"graduated": true,
"allow_edit": true,
"allow_delete": true,
"future_enrollments": true,
"role_ids": [
0
]
}

I'm passing the user_id from User Create endpoint, But in my testing i'm using a test dummy user i've created.

I'm finding the grade_level_id from Core Grade Levels:

{

"id": 6600, << i'm using this for grade_level_id

"active": true,

"description": "Holy Names University",

"name": "Freshman",

"promote_to_code": 3

}

I'm finding the school_level_id from Core Levels:

{

"id": 1921, << i'm using this for school_level_id

"abbreviation": "HNU",

"name": "Holy Names University"

}

I'm finding the school_year_label from Core years ( current yeary = true ):

{

"id": 8648,

"begin_date": "2021-08-16T00:00:00-04:00",

"current_year": true,

"end_date": "2022-08-15T00:00:00-04:00",

"published": true,

"school_year_label": "2021-2022"

}

enroll_date = todays date

depart_date = “”

"current_year": true

"has_grades": true

"grade_repeated": true

graduated": true

allow_edit": true

allow_delete": true

"future_enrollments": true

I'm finding the role_ids from Core Roles

{

"id": 57904,

"base_role_id": 14,

"hidden": false,

"name": "Student"

}

Comments

  • Sorry,

    I'm using the Core Years > School year label > 2021-2022

    &

    I'm using the core role > base role id >14

  • Here is the process I'm running if it help someone ID where I'm going wrong. I've built custom connectors on the Microsoft Power Platform to connect to the available school API endpoints. This way I can quickly build Business processes that seemlessly interact with Dataverse tables and the other 365 Azure services. Mimicking the custom connectors I saw RE/NXT FE/NXT using to build reports.

    I start by creating a user - this is working great

    a364f10ba700669741001385e56ed860-huge-st

    Then I add the phones - again, working great. I use the User_id that is returned from the above user create post..

    e719c0f112e106dd3a0f95e941c5ddf2-huge-ph

    Then add the address - working great. Still using the returned user_id from the original user create

    a7a90370f0758ce37017e9a62683be1a-huge-us

    And now I want to add the Student Rold to the user object - I'm Posting to the Users enrollment create endpoint because of the Role_Ids at the bottom. I thik it will add the role but I'm unsure now..

    047c3341d846f418f1d0016903792e1e-huge-us

  • cc8dd8379f7074fca9247782db11f4e4-huge-sk

    Trying to enroll new users through the /school/v1/users/enroll. Does anyone know how I should properly format this request?

    Bump,

    Jeremiah

  • Jeremiah, I wanted to verify that your School year label Len = 11 , it should be 2021[ ]-[ ]2022 (brackets included to show the spacing)

  • I'm still trying to find a successful way to post an enrollment row to a newly created user object. If anyone has been able to post to this endpoint successfully and can help identify where I'm going wrong I would really appreciate the help!

    Thank you,

    Jeremiah

  • Hi Jeremiah,

    I think that the issue you are experiencing is due to the session_id parameter which is required for the User Enrollment Create endpoint for Higher Ed. This can be obtained from the core sessions endpoint a valid construction would be

    {

    "user_id": your value,

    "grade_level_id": your value,

    "school_level_id": your value,

    "school_year_label": your value,

    "enroll_date": your value,

    "depart_date": “”

    "current_year": your value,

    "has_grades": your value,

    "grade_repeated": your value,

    "graduated": your value,

    "allow_edit": your value,

    "allow_delete": your value,

    "future_enrollments": your value,

    "session_id": obtain from core session endpoint,

    "role_ids": [ your value ]
    }

    Hope this helps!

  • Thank you so much Erik for responding!

    After some trial and error I was able to get my first 200 OK! Thank you for that len = 19 hint and the spacing.

    After posting to the endpoint I checked the test user for the enrollment row but nothing has been added. There was an existing enrollment row on the record before I ran the v1/users/enroll and it was removed/deleted? from the record and I can no longer add any enrollment rows to the test record through the GUI.

    Do you mind if I ask a few questions?

    Where did you find the documentation for the school year label string length & spacing?

    Is the duration ID required for Higher Education? If so where do I pull this data point from?

    Do I need to pay special attention to the allow edit, allow delete attributes? I defaulted them to true.

    Should Future enrollments be set to true for all posts & and does this matter?

    Thank you,

    Jeremiah Ellington

    786553faa8f211b7444da3fe47543483-huge-im
    716a9d324d9b6603ef2f0595c31cb6b8-huge-im
  • Hello Jeremiah,

    In response to your questions…

    After posting to the endpoint I checked the test user for the enrollment row but nothing has been added. There was an existing enrollment row on the record before I ran the v1/users/enroll and it was removed/deleted? from the record and I can no longer add any enrollment rows to the test record through the GUI.

    When I tested this the enrollment was added (as well as viewable, editable and removable) in Core on the Personas fast tab

    Do you mind if I ask a few questions?

    Where did you find the documentation for the school year label string length & spacing?

    I am not certain there is adequate documentation about this, in the database school year label is formatted as an 11 character string with spaces around the hyphen, this may or may not affect the API call depending on how each is implemented

    Is the duration ID required for Higher Education? If so where do I pull this data point from?

    duration ID is not required for Higher Ed, session ID is required for Higher Ed

    Do I need to pay special attention to the allow edit, allow delete attributes? I defaulted them to true.

    I agree that defaulting these values to true is your best bet unless you have a specific use case to set them false

    Should Future enrollments be set to true for all posts & and does this matter?

    for Higher Ed the Future enrollments flag is overridden with a value of false, I am not sure why this is the case.

    I hope this helps!

    -Erik

  • Erik, I have a follow up question on this endpoint, not directly Jeremiah's problem but this is the only thread going on this endpoint.

    I was working on bulk-enrolling newly created students for next year. I was able to successfully run things, but it didn't create things properly.

    020e8acdb9fbc4f0164a7b9817733bf6-huge-im

    This is a snippet of the code I used. The important bit to call out is that I specified “school year label” as “2022 - 2023” and set “future enrollments” to True. The grade level is set to my 11th grade, and the role is the id for “Incoming Student”

    In Core, it correctly created the future enrollment fro 2023 - 2024 as a 12th grader, but not the 2022 - 2023 enrollment as an 11th grader (with hopefully an Incoming Student) role.

    7bc655407ca820d24054b0d68e89a365-huge-im

    Any idea what may have gone wrong here? Or what I can do to bulk fix it? There's no PATCH endpoint, and re-running it with slightly different values gives me a nice “An exception occurred. Please contact Support.” error.

    Thanks!


Categories