Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
I am trying to create a Catalog entry though the API call. It created successfully but there is no Listing image.
Documentation says: course[listing_image] : URL or file upload for the image to be shown with this listing : String.
I'm trying to use URL and verified it is definitely valid and accessible.
Alternatively, what do they mean by "file upload"?
Any ideas or suggestions? Here is my JSON:
{ "title": "My test course", "description": "My test course- long description here", "listing_path": "2020-21-myTestCourse", "listing_image": "http://myfavoritehosting.edu/mywebapp/catalogimage.jpg", "teaser": "It's gonna be great!", "account_id": 9486, "catalog": { "id": 9486 }, "canvas_course": { "id": 1566 }, "visibility": "listed", "enrollment_open": true }
Thank you!
Bump. Anybody here?
Any help from Instructure developers? From Thoma Bravo?
Our district doesn't use the catalog, but are you getting any errors back in the response when you create the course? Or, if you inspect the element in the browser once it's created, do you see any errors in the HTML or CSS?
As far as a file upload, there's a File Upload endpoint and workflow that allows you send items directly to Canvas instead of using a URL reference. If using a URL reference doesn't work, it might be worth trying the upload step as part of the debugging.
Thank you for your response.
No there is no errors returned from Catalog. Course is simply created without image.
No errors in the Catalog page either. It is not trying to load my image from wrong location, or something like that.
Still looking for solution 🙂
SOLVED: I am not a coder, but I did figure this out, so I thought I would share in case someone stumbles across this old post.
The solution is that your Catalog listing data must be enclosed in a "course" container in your code, and there are some requirements around the image as well. Image Requirements:
This is a working API URL constructed and submitted with Postman (assumes authorization key is properly configured for Canvas API and you're using your own Catalog info) for a subcatalog with the account_ID 9999, a Canvas Course with ID 0001, course name, teaser, description, path, visibility, and listing_image as a URL
https://your-catalog-instance.instructure.com/api/v1/courses/?course[account_id]=9999&course[canvas_course_id]=0001&course[title]=API Course 1&course[description]=This is a description&course[teaser]=this is a teaser&course[path]=api-course-1&course[visibility]=listed&course[listing_image]=https://somesite.com/image.png
In my Ruby script (Mac), which pulls the data from a CSV file, it looks something like this when creating the listing - note the course container:
course:{
canvas_course_id: course_id,
title: listing_title,
path: listing_path,
teaser: listing_teaser,
description: listing_description,
visibility: listing_visibility,
account_id: subaccount_id,
listing_image: catalog_image
}
Final thoughts:
In my case my images are actually publicly accessible on the web, so the URL method works great for me. Consequently, I did not attempt a file upload from my computer.
In case you need to do this as an upload, this is what instructure shared with me about this workflow with a file upload, using cURL in their example:
curl -i 'https://instance.catalog.instructure.com/api/v1/courses ' \ -X POST -H "Authorization: Bearer insert_token_here" \ -F 'course[title]=title_here' \ -F 'course[description]= description' \ -F 'course[path]=unique-path- here' \ -F 'course[teaser]=teaser' \ -F 'course[canvas_course_id]= course_id_here' \ -F 'course[listing_image]=@image_ file.png'
If you are using an SVG image you also need to include the type with course[listing_image] added with something like:
-F 'course[listing_image]=@image_file.svg;type=image/svg+xml'
Cheers!
Melinda
Melinda,
Thank you for your response, it didn't work for me for some reason.
I first changed my image URL to HTTPS - that didn't change anything
Then I have added "course":{ ... } as you suggested. That gave me "Internal Server Error" as a response from Catalog
I'm still looking for answers 🙂
To participate in the Instructure Community, you need to sign up or log in:
Sign In