canvasapi icon indicating copy to clipboard operation
canvasapi copied to clipboard

get_appointment_groups is broken

Open eric-vader opened this issue 1 year ago • 6 comments

Describe the bug

get_appointment_groups API is broken.

To Reproduce

Steps to reproduce the behavior:

  1. Go onto Canvas, create an appointment group
  2. canvas.get_appointment_groups() does not yield results (ie. it is empty)

Although, canvas.get_appointment_group(id=id) does work as expected.

Expected behavior

canvas.get_appointment_groups() should not return an empty array and should return the appointment group obj.

Environment information

  • Python version (python --version) Python 3.12.4
  • CanvasAPI version (pip show canvasapi) 3.3.0

Additional context

I couldnt get create_appointment_group to work properly as well (cannot create appointment), not sure if it is related.

eric-vader avatar Dec 18 '24 15:12 eric-vader

Can you try a couple things?

  1. When you try to use canvas.create_appointment_group, are you passing it a course context code? This is required according to the Canvas docs. A sample of your script may help identify the problem.
  2. When you request appointment groups, are you passing it a scope? If the scope is missing, Canvas defaults to "reservable," but if there are none, it would result in an empty list.

bennettscience avatar Dec 19 '24 02:12 bennettscience

I have followed your suggestions and have managed to make it work. Thanks so much!

eric-vader avatar Dec 24 '24 08:12 eric-vader

Do you mind explaining what you ended up doing? This may be something that could be cleared up by some more information being added to the docs.

bennettscience avatar Dec 24 '24 19:12 bennettscience

Ping @eric-vader - Any update on what you did to get it to work? If it was one of those request parameters, it might be worth documenting.

bennettscience avatar Dec 27 '24 01:12 bennettscience

For create_appointment_group i could get it to work after adding the appointment_group['new_appointments']['0']=... For get_appointment_groups needed the context code which was f'course_{course_id}' along with scope='manageable' to list as expected.

eric-vader avatar Dec 28 '24 06:12 eric-vader

Thanks. I am going to mark this as a bug because the context_code param should be required. Hopefully I can get a patch in this weekend.

bennettscience avatar Dec 28 '24 15:12 bennettscience