cancel
Showing results for 
Search instead for 
Did you mean: 
brian_t_anders
Community Contributor

Get Course Settings via API

Jump to solution

I feel really silly right now for either (1) not being able to find the correct API call  (2) not knowing that such a call doesn't exist or (3) finding the parameters I'm looking for using the UI.

I would like to automate the creation of my upcoming courses. I need to gather the settings of my previous semester courses as the creation of new courses using the API is calling for many additional parameters than what the UI asks for. All of my previously created courses were created manually and I would like to pull the settings of the previous semester courses via the API (or otherwise), and use those settings for creating the new courses.

The problem is I cannot find the settings of the old courses using the API. Some of the parameters I would like to find are:

-course[is_public]

-course[self_enrollment]

-offer

What do I need to do to get all of the appropriate fields for course creation via API from an already-created course? Could my ability to see course settings be limited based on my admin access?

0 Kudos
1 Solution

Accepted Solutions
jsavage2
Community Contributor

Hi  @brian_t_anders ,

That's a slightly different set of options than the original question, and there are a couple of things going on here.

The first is a category of "settings" that don't exist in the parent course, because they're options for the course creation process itself, not settings on the created course. Those are things not prefixed with "course[]". That's "offer," "enroll_me", and "enable_sis_reactivation." Those are questions for you, not things that can be copied: do you want to publish the course now, or leave it unpublished (offer)? Do you want to be enrolled in the course(enroll_me)? Do you want to check to see if there is an existing, deleted course with the same sis_id (possibly with existing content and enrollments) and reactivate it? Or do you want to create a new course? Translation: did a faculty member hit "delete" by accident and you're trying to bail them out through the API? (enable_sis_reactivation)

The second are things that are probably disabled at the account level. If you're not seeing the wiki stuff, it's almost certainly because you've disabled Course Content add/edit/delete for the student role and course settings can't override it. Most places do. Ditto open/self enrollment. 

The third is is things that are shown somewhere else. Forum settings are accessible through the course settings endpoint (GET /api/v1/courses/:course_id/settings). The grading standard--*if* it is set--can be found there, too. Why there is that handful of setting tied to the other API, I can't say.

The syllabus_body has to be requested with the "include[]=syllabus_body" option to the Get a Single Course endpoint 50581462 mentioned above, probably because it can be quite large.

View solution in original post

8 Replies
ColinMurtaugh
Community Champion

Hi Brian --

Have you tried calling the "get a single course" endpoint?  That should return a Course object containing both of the parameters that you're looking for.

If not, it might be helpful if you can give us some more details: what's the workflow state of the course? What role do you have in the course? What role do you have in the account that contains the course? 

--Colin

I am an account admin responsible for creating the courses and populating the courses with the base content. I am not a root level account admin, however.

When I make the 'v1/courses/{id}' call, the response includes most of what I want, but it does not include some of the permission related attributes, even when I use the include permissions parameter. In fact, none of the include parameters pull the information I am looking for.

I'm unsure how these attributes behave if they are disabled at the root level. Could that be the reason I am not seeing them?

Hi Brian --

One tricky thing about the include parameter is that it needs to have empty square brackets after it; for example, the URL will look like:

/api/v1/courses/{id}?include[]=permissions

However, note that the permissions that are returned are not the course-level permission settings (like course/institution/public) -- they are a set of permissions that the user calling the API has within the course, like:

    ...
    
"permissions": {
        "create_discussion_topic"false,
        "create_announcement"false
    },
...
I'm surprised that you can get the basic course object but aren't getting the "is_public" and "is_public_to_auth_users" parameters -- as far as I can tell those should always be there. In my testing, even people with a teacher or student role in the course are able to see those parameters (even if their role is concluded). Would you be willing to share what you're getting when you fetch a single course? (You can remove/mask any sensitive values in the data). 
--Colin

I wasn't very clear in my reply about what information was passed back. Sorry about that. I've redacted some of the info, but the response is below.

{
"id": xxxxx,
"name": "xxxxx",
"account_id": xxxxx,
"uuid": "xxxxx",
"start_at": null,
"grading_standard_id": null,
"is_public": false,
"created_at": "2018-10-02T15:27:23Z",
"course_code": "xxxxx",
"default_view": "modules",
"root_account_id": 1,
"enrollment_term_id": 1,
"license": "private",
"grade_passback_setting": null,
"end_at": null,
"public_syllabus": false,
"public_syllabus_to_auth": false,
"storage_quota_mb": 50000,
"is_public_to_auth_users": false,
"hide_final_grades": false,
"apply_assignment_group_weights": false,
"calendar": {
"ics": "xxxxx"
},
"time_zone": "America/New_York",
"blueprint": true,
"blueprint_restrictions": {
"content": true,
"points": false,
"due_dates": false,
"availability_dates": false
},
"sis_course_id": null,
"integration_id": null,
"enrollments": [],
"workflow_state": "available",
"restrict_enrollments_to_course_dates": false
}
jsavage2
Community Contributor

Hi  @brian_t_anders ‌,

It's not always intuitive. The trick, here, is that there is a slight difference in the naming convention between the endpoints, since the POST request takes HTTP form parameters as input, but the GET request returns JSON.

So the input to the 'course[is_public]' form parameter is the 'is_public' vlaue from the 'course' object, etc.

e.g.,

{ 
...
"is_public" : false, # line 8 in your paste
...

becomes:

&course[is_public]=false

"Offer" is just what the api calls "publish," so that's not a setting you get from the existing course, it's a decision you make what you're ready.

Best,

--j

brian_t_anders
Community Contributor

Thank you,  @jsavage2 ‌ for your response.

I understand the nomenclature for all of these parameters, and it is fairly simple for me to take one course object, and find the necessary parameters, and use them for creating courses. There are just a few that I am unable to find. These are specified as follows:

course[allow_student_wiki_edits]

course[allow_wiki_comments]

course[allow_student_forum_attachments]

course[open_enrollment]

course[self_enrollment]

offer

enroll_me

course[default_view]

course[syllabus_body]

course[grading_standard_id]

enable_sis_reactivation

(One or two of these may be available, but I know some of them aren't.)

I understand one or two may be redundant, such as 'enroll_me'. Where else can I find these parameters?

jsavage2
Community Contributor

Hi  @brian_t_anders ,

That's a slightly different set of options than the original question, and there are a couple of things going on here.

The first is a category of "settings" that don't exist in the parent course, because they're options for the course creation process itself, not settings on the created course. Those are things not prefixed with "course[]". That's "offer," "enroll_me", and "enable_sis_reactivation." Those are questions for you, not things that can be copied: do you want to publish the course now, or leave it unpublished (offer)? Do you want to be enrolled in the course(enroll_me)? Do you want to check to see if there is an existing, deleted course with the same sis_id (possibly with existing content and enrollments) and reactivate it? Or do you want to create a new course? Translation: did a faculty member hit "delete" by accident and you're trying to bail them out through the API? (enable_sis_reactivation)

The second are things that are probably disabled at the account level. If you're not seeing the wiki stuff, it's almost certainly because you've disabled Course Content add/edit/delete for the student role and course settings can't override it. Most places do. Ditto open/self enrollment. 

The third is is things that are shown somewhere else. Forum settings are accessible through the course settings endpoint (GET /api/v1/courses/:course_id/settings). The grading standard--*if* it is set--can be found there, too. Why there is that handful of setting tied to the other API, I can't say.

The syllabus_body has to be requested with the "include[]=syllabus_body" option to the Get a Single Course endpoint 50581462 mentioned above, probably because it can be quite large.

View solution in original post

brian_t_anders
Community Contributor

The second are things that are probably disabled at the account level. If you're not seeing the wiki stuff, it's almost certainly because you've disabled Course Content add/edit/delete for the student role and course settings can't override it. Most places do. Ditto open/self enrollment. 

This is the answer I was looking for. I usually test in the live API before doing any automation. When I saw these parameters, I wanted to match them from a previously created course, and not finding them caused me to get on here and ask. I may have further questions but for now, I have what I need. Thank you.