Extracting user information programmatically

Hi,

I am using Verawood with the new implementation of PROFILE_EXTENSION_FORM and storage. What would be the best way to extract this user information programmatically from OpenEdX ?

In particular, I want to extract the list of users with their name, email address as well as custom profile fields (added through a fork of GitHub - BryanttV/custom-extra-fields: An example app for extending user profile fields in Open edX · GitHub REGISTRATION_EXTRA_FIELDS and PROFILE_EXTENSION_FORM)

I don’t mind running a script through tutor local run lms ./manage.py lms shell -c, but a web API access would be best.

I think I resolved the “running a script” part:

$ cat extra_custom_fields.py
from custom_extra_fields.models import CustomExtraFields
i = 0
print(f'record id, username, email, research area, position, wants newsletter')
for e in CustomExtraFields.objects.all():
    print(f'{i}, {e.user.username}, {e.user.email}, {e.research_area}, {e.position}, {e.wants_newsletter}')
    i += 1

and then

[tutor@edx1 ~]$ tutor local run lms ./manage.py lms shell -c "$(<extra_custom_fields.py)" 2>&1 | grep "^[0-9]*,\|^record"

will print those records.

I would still prefer if there is a way with a remote API. If anyone has pointers for that ?

@bryantt-v any thoughts?