cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Team
Community Team

All things API

Have a question about the Canvas APIs? Have a cool API integration you'd be willing to share? If so, please post here.

Labels (1)
Tags (1)
271 Replies
Highlighted

Thanks for your research James, 

I was not aware of this limitation on this include[] parameter. I could have guessed, because there are other include[] params in the API that have similar permission restrictions. The basic philosophy behind those restrictions is somewhat obscure to me though.

If I understand correctly, I am not the user with root priveliges I claimed (and thought) to be then ... I'll go figure out what exactly I am to our Canvas API then 😉

P.S. found it:

I was testing this with our developer-key in Postman, which would indeed run into this not-a-course-user restriction.

Using our LTI-integration with my personal credentials (user with course enrollment or account/course-admin-user) will give the expected results.

Highlighted

Dear philip.brands@eur.nl,

I looked at the code that is at lib/api/v1/course.rb that implements the course API, it first filters out whether the user making the call has the permissions to get the data and if so computes the sections as follows:

         hash['sections'] = section_enrollments_json(enrollments) if includes.include?('sections')

So if the include[] includes 'sections' then it calls section_enrollments_json(enrollments)

The code for this can be found in: lib/api/v1/section_enrollments.rb - where this code is simply:

module Api::V1::SectionEnrollments
   def section_enrollments_json(enrollments)
     enrollments.map do |enrollment|
        section = enrollment.course_section
        section_json = section.attributes.slice(*%w(id name start_at end_at))
        section_json[:enrollment_role] = enrollment.type
        section_json
        end
     end
end

According to Courses - Canvas LMS REST API Documentation  enrollements is "

// A list of enrollments linking the current user to the course

thus if the current user (the one calling the API) is not in the course, there will be no section information. Thus it is likely not your permissions, but rather this limitation based on enrollments that causes the section information to be [].

It would seem to be a conscious decision to limit the enrollment information, as even the List enrollments API notes: "note: Currently, only a root level admin user can return other users' enrollments. A user can, however, return his/her own enrollments."

Highlighted
Community Member

Hi there, I am new to Canvas and I'd like to use it for my organization. Before that I really need to know if there is a way for my developers to interact with Canvas' video player API (i.e. Will I be able to prevent my students to see the following video without having finished the previous? Will I be able to embed a script to launch a random pop-up that asks a student if he is still watching the video to test his attention?). To sum up I would like to know what is the level of personalization of your platform (of course I'd like to suscribe to the full account and not only to the free one). Please let me know Smiley Happy Best, Emanuela

Highlighted

emanuela@gopillar.com‌,

You should try to leverage the built in features in Canvas as much as possible before moving to custom development.  

1.  Canvas can limit progress using modules. So you can have students be unable to move forward until they view a resources, complete a quiz, etc...

2.  A built in method of assessing a video is to use a video as the description of a quiz... this way they watch the video and then take the quiz.  You can then allow multiple attempts.  I really like this method myself.

3.  You can embed an outside video tool that has pausing of videos with pop-up questions.  Instructure's product Arc may have the features you are looking for (Arc | A Better Video Platform for Better Online Learning ), or you may want to look at other toolsets (Camtasia and other products have these features) where you can simply embed the content.

4.  For our organization we often host the videos externally to canvas and embed the content (Vimeo, youtube, google drive, etc...).  This works for us well.

Highlighted

Hi Josh, 

thank you for your kind reply. This was helpful, anyway I am gonna explain my situation in details so you can help me even more. We, as a company, would like to do courses for architects and engineers in our country (Italy), here to access the possibility to give our customers a special kind of certification at the completion of the course, the national organization of architects and engineers aks us for special requirements (like the ones I wrote above in the examples). So we are wondering if it is better for us to write our own website or if there is some sevice (like yours) that we can use but customizing the code tu fulfill the above-mentioned requirements. So, it is vital for me, in order to choose your service, to know if it would be possible for our developers to touch the code of the video-player in order to tailor it on our needs and also if your website give access to the log data of users (when they have seen each video, how many times etc).

Said that, I think that point 1 and 3 of your answer could be very helpful and I am gonna fully explore your tool Arc (even if I fear that it is only for live webinars) and this other Camtasia that you suggested.

Many many thanks for your assistance and patience,

regards,

Emanuela

Highlighted

emanuela@gopillar.com‌,

I don't work for Instructure.  I work for a small College that uses their product.  We don't use ARC so I don't know it's feature set well.

We have heavily customized Canvas in some cases to do the kinds of thing you ask for, so they seem very possible... with that said, it may or may not be your best solution.  You should engage with Canvas sales and get setup with a demo account if possible.  Some customizations (custom JavaScript and Custom CSS) you can't do with the free teacher account.

Highlighted

Hi Josh, 

I am sorry I didn't know. Your feedback was really helpful anyway, I will do as you suggested!

Many thanks and kind regards,

Emanuela

Highlighted

Here is some undocumented behavior I have noticed with the File Uploads API and the 'unfiled' folder. I used the following parameters:

on_duplicate: 'overwrite'
parent_folder_id: 'sample id goes here'

If the file I attempt to upload is identical to the file in the target folder, it will create or update a file in the 'unfiled' folder. I don't mean identical in name alone, I mean if the file content and the file name is identical. As soon as I attempt to upload a file that is identical in name, but not identical in content, the API updates and overwrites the target file in the target folder as expected.

It is already documented (see below) and understood that if the file I attempt to upload has the same name as a file in the target folder, it will overwrite the target folder's file. The 'unfiled' folder appears to be completely undocumented. Also note that 'overwrite' is the default value if you don't specify.

From File Uploads documentation ( Uploading Files - Canvas LMS REST API Documentation 😞
on_duplicate
How to handle duplicate filenames. If `overwrite`, then this file upload will overwrite any other file in the folder with the same name. If `rename`, then this file will be renamed if another file in the folder exists with the given name. If no parameter is given, the default is `overwrite`. This doesn't apply to file uploads in a context that doesn't have folders.


Hope this helps, I know it took me way too long to figure this out.

Highlighted
Surveyor

It's been awhile since I had an API question I wasn't able to figure out and forgot this thread existed so I posted a question about setting to do dates on assignment pages using the API that I will post here as well in case anyone has any insights.

Last Fall Canvas added the ability to set a date on pages so that they appear in the student to do list:

308031_pastedImage_1.png

308032_pastedImage_5.png

Unfortunately, there is no information about this functionality available in the Pages API.

 

I can view that date using the List pages or Show page API

308033_pastedImage_3.png

 

I have tried the typical Update/create page api pattern for updating page information by passing wiki_page[todo_date] as a date similar to what I would do to update an assignment date, but that doesn't appear to do anything.

 

Anyone worked with this yet, or any of the awesome Canvas Engineers have any information on how to set this date through the API?

 

Thanks fo any insights!

Highlighted