Hi community. How I can get the course card from canvas data portal? Or some way to get this.

Jump to solution
fernpena
Community Novice

We are thinking in automatic reports for courses and we need the course card in each report.
Thanks and greetings from Chile!

1 Solution
James
Community Champion

That was very weird, it looks like entire reply I made to Robert got wiped out when I went to save it. I'll try to repeat as much of it as I can remember.

 @fernpena  

There are two ways to get a course card image into Canvas. Only one of those shows up as a file ID. Canvas supports Unsplash (used to support Flickr) and file uploads.

I wouldn't use Canvas Data to get it. Besides being out of date, it's problematic as Robert explained and doesn't include those that point to an external site.

The Get course settings endpoint of the Courses API returns three fields.

  • image_url is for an external image. Files from Unsplash and Flickr have this property, otherwise it's the empty string.
  • image_id is the file ID for a file uploaded to Canvas. Only files uploaded to Canvas have this property set, otherwise it's empty.
  • image is a URL that includes any extra parameters (like a JWT token needed to authorize access) to the file and is the one that should be used. This property is set for either technique and it's the one you would want to use with an external program.

If there is no course image, then all three properties are the empty string.

Here are some examples of what you'll get

My wife's flickr image:

350654_pastedImage_2.png

My file I uploaded to Canvas (I cut off the image - it was 3 lines long since it has the JWT authorization):

350655_pastedImage_3.png

View solution in original post