Enabling Custom Course Settings

Hi all,
I’ve found this interesting feature: Enabling Custom Course Settings.
This adds an “Other course settings” field in the course’s advance configuration.


Does anybody know where is this data stored? How can it be used in another application?

There’s a brief description included in the PR that brought that feature into the platform:

This adds a field to the “advanced settings” page of each course that allows the user to store additional metadata about the course, in a JSON dictionary, without requiring updating the platform code.

The idea is that this field can hold metadata like “ID of the course in external system”, course difficulty, or other instance-specific metadata about the course that needs to be available to the theme, CRM software, a marketing site, ecommerce, or other external systems.

The new field is protected by a feature flag which is False by default, so it won’t show up in Studio unless you enable the flag.

Hi Dave!
Thanks for your response!
I’ve seen that also in the docs… however I don’t know how to retrieve that information if I want to use it. Do you know where is it stored, and how to query it?

Hello everyone,

I’m using Tutor 13.2.2 e Open edX maple.3 and enable the feature ENABLE_OTHER_COURSE_SETTINGS in CMS. The idea is to have an integration using the REST API, but I couldn’t find an endpoint to get this information.

I’ve tried all GET endpoints with a course_id as path param.

Ref.: Add Course Metadata

1 Like

They should be available as a field for the root CourseBlock of a course in the Course Blocks API

Edit: And probably also as part of the OLX export?

I got it!

  1. Getting access token: the path in the doc is wrong, the right is /oauth2/access_token, without v1 or v2.

    curl --location --request POST 'https://${LMS_HOST}/oauth2/access_token' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'grant_type=client_credentials' \
    --data-urlencode 'client_id=${CLIENT_ID}' \
    --data-urlencode 'client_secret=${CLIENT_SECRET}'
    
    {
        "access_token": "xxx-very-secret-access-token-xxx",
        "expires_in": 36000,
        "token_type": "Bearer",
        "scope": "read write email profile"
    }
    
  2. Enable feature ENABLE_OTHER_COURSE_SETTINGS

  3. Enable COURSE_BLOCKS_API_EXTRA_FIELDS

  4. Getting course blocks: add query param: requested_fields=other_course_settings

    curl --location --request GET 'https://${LMS_HOST}/api/courses/v2/blocks/?course_id=course-v1%3AOrg%2BDO101%2B2022-04&username=admin&requested_fields=other_course_settings' \
    --header 'Authorization: Bearer ${ACCESS_TOKEN}'
    
1 Like

Great @erickhgm!
Worked like charm! Only had to use double quotes to have the variables replaced.

I also found where is it persisted in MongoDB:
It’s in the modulestore.structures collection, in the fields dict of the course block type:

{
   "_id":"ObjectId(""nnnnnnn"")",
   "root":[
      "course",
      "course"
   ],
   ...
   "blocks":[
      {
         "fields":{
            "display_name":"Demonstration Course",
            ...,
            "other_course_settings":{
               "test_other_course_settings":"value"
            },
            "show_calculator":true,
            ...

Many thanks for your help!

1 Like

Hi Erick,

I tried this and it works in general. But, everytime I change the content of the other_course_settings field in an Open Edx Course (via the browser) the other_course_settings field disappears completely from the API result! In my experience for a few days, then it shows up with the new information. That’s very weird! Do you have a hint for me how to avoid this?

Thanks and best!

1 Like

Hi @resa,
It’s strange… I’ve tested it and noticed a few seconds until the change is reflected in the API output but not days as you mention, or having the field disappeared. May be a cache issue?

Hi Andres,

thanks a lot for your answer. That’s what we thought, too, at first. But, when I enter something in the “other course settings” field via the browser, the field disappears at once in the API result. If it would be a cache issue, I would see the old value for a while. We use the Version olive, maybe that could be a problem?

Thanks a lot again,
Remon

I’m running Olive.4. I tested again today with Postman and it worked fine.
Make sure you have these settings:

"FEATURES": {
        "ENABLE_OTHER_COURSE_SETTINGS": True
}
"COURSE_BLOCKS_API_EXTRA_FIELDS": [
            ('course', 'other_course_settings')
],

Thanks, Andres!

I will give it a try again when our palm Version is ready, although it should work with olive, too.

Best
Remon