instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.41k stars 2.42k forks source link

Update Course image in Settings using API #2320

Open vishalgvk opened 4 months ago

vishalgvk commented 4 months ago

Summary: Unable to update image of Course in CourseSettings using API

Steps to reproduce:

  1. PUT request to /api/v1/courses/:courseId/settings with request body being { "image_id": "1" , "image_url": _imageUrl_ , "image": _imageUrl_ }
  2. Postman gives response 200 with old CourseSettings object as response (image isn't being updated)

Please let me know if it's possible to update image or bannerImage of Course using API

vishalgvk commented 4 months ago

I found the solution after multiple trials.

Solution: Send a PUT request to Course (but not CourseSettings) passing only image_id (image_url and image aren't required). In the response, even though the updated data doesn't appear, that's fine. We have to verify the updated image_id by making GET request to CourseSettings (but not Course).

So, this can be considered as a bug in canvas-lms api.