Anyone plz help me, can anyone tell me how can i enroll user into a course from my local system

i am trying to call this https://www.grassroots-dev.online/api/enrollment/v1/enrollment
with these json
{

"action": "enroll",
"course_id": "course-v1:mexyon+SEOMex1+SEOMex1",
"id":2,
"user": "Shahzadbaloch43333@gmail.com",
"course_modes": "honot",
"is_active":true

}

i have tried everything but its keep responding me
{
“message”: “Course ID must be specified to create a new enrollment.”
}

then i find that i only can enroll a logged in user into a course…

is there any way to enroll a user into my open edx course with just course id user id or email or username with api secrect key and super admin access token without making him logged in???

Hi @Shahzad_Baloch

Welcome to the community!

I’m not sure how to enroll a user in a course without login, but I can help you get this API working.

It seems like the issue is with the format you’re using for the course ID. Please pass the course ID in the following format:

"course_details":{"course_id": "edX/DemoX/Demo_Course"},

nop this api can only enroll loggedin user
i need a solution where i can call an api from my custom software to create user enrollement after sending secret api keys and acces token…

@Shahzad_Baloch I did this a while back, so I’m unsure if things have changed. But what I remember from a while back is if you trace the code there is a single line that checks if the user who is making the request is the one who is getting enrolled. Modify that code to check if the user is a superuser, and then make sure your requests are coming from an API key that is tied to a super user account.