Add note endpoints to API
This commit is contained in:
parent
53dfe0df22
commit
0e3dcda1ff
2 changed files with 31 additions and 0 deletions
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
CakeCMS Python API
|
||||||
|
==================
|
||||||
|
|
||||||
|
This python class provides easier programmatic access to the CakeCMS course management system.
|
||||||
|
For a basic documentation on the CMS API functionality, see its help section:
|
||||||
|
[https://cms.cispa.saarland/system/help/api](https://cms.cispa.saarland/system/help/api)
|
||||||
|
|
||||||
|
To learn about the available methods, see [cakecms/cakecms.py]().
|
||||||
|
|
||||||
|
Example scripts with common use-cases can be found in the directory [examples/]().
|
||||||
|
|
|
@ -221,3 +221,23 @@ class CakeCMS:
|
||||||
'unregister': json.dumps(unregister),
|
'unregister': json.dumps(unregister),
|
||||||
'system': system}}
|
'system': system}}
|
||||||
return self.post('registration_items/import/' + str(id), body).json()
|
return self.post('registration_items/import/' + str(id), body).json()
|
||||||
|
|
||||||
|
def notes_index(self, course=None):
|
||||||
|
"""
|
||||||
|
:param course:
|
||||||
|
:return: List of all notes configured in a course.
|
||||||
|
"""
|
||||||
|
return self.get('notes/index', course=course).json()['notes']
|
||||||
|
|
||||||
|
def notes_change(self, note_id, student_id, value, course=None):
|
||||||
|
"""
|
||||||
|
Edit the value of a note for a single student.
|
||||||
|
:param note_id:
|
||||||
|
:param student_id:
|
||||||
|
:param value: str, int or bool
|
||||||
|
:param course:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
if value is True: value = 1
|
||||||
|
if value is False: value = 0
|
||||||
|
return self.post('notes_entries/change', {'NotesEntry': {'student_id': student_id, 'note_id': note_id, 'value': value}}, course=course)
|
||||||
|
|
Loading…
Reference in a new issue